summaryrefslogtreecommitdiffstats
path: root/README.org
blob: 294ef828f42e75b74b89e862753f9739994ae3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
* Emacs configuration
** General
#+BEGIN_SRC emacs-lisp
  (setq enable-local-variables nil)
#+END_SRC

*** Auto save
#+BEGIN_SRC emacs-lisp
  (setq make-backup-files nil)
  (setq auto-save-default nil)

  (setq desktop-path (list user-emacs-directory))
  (setq desktop-auto-save-timeout 30)
  (desktop-save-mode 1)
#+END_SRC

*** Auto delete trailing whitespaces
#+BEGIN_SRC emacs-lisp
  (defun gearnode/remove-trailing-whitespaces ()
    (delete-trailing-whitespace))

  (add-hook 'before-save-hook 'gearnode/remove-trailing-whitespaces)
#+END_SRC

*** Style
#+BEGIN_SRC emacs-lisp
  (face-spec-set 'default '((t :font "Roboto Mono for Powerline")))
#+END_SRC

Replace tab by space
#+BEGIN_SRC emacs-lisp
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default show-trailing-whitespace t)
#+END_SRC

#+BEGIN_SRC emacs-lisp
(setq-default fill-column 78)
#+END_SRC

*** Window
#+BEGIN_SRC emacs-lisp
  (add-to-list 'default-frame-alist '(height . 101))
  (add-to-list 'default-frame-alist '(width . 170))

  (setq inhibit-startup-screen t)
  (menu-bar-mode -1)
  (toggle-scroll-bar -1)
  (tool-bar-mode -1)
#+END_SRC

Display line number in the gutter.
#+BEGIN_SRC emacs-lisp
  (setq column-number-mode t)
  (global-display-line-numbers-mode)
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (blink-cursor-mode 0)
  (setq x-stretch-cursor t)
#+END_SRC

*** Alias yes or no
#+BEGIN_SRC emacs-lisp
  (defalias 'yes-or-no-p 'y-or-n-p)
#+END_SRC

*** Load PATH env
#+BEGIN_SRC emacs-lisp
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize))
#+END_SRC

*** Cursor
#+BEGIN_SRC emacs-lisp
  (blink-cursor-mode 0)
  (setq x-stretch-cursor t)
#+END_SRC

** Modes
*** helm
#+BEGIN_SRC emacs-lisp
  (require 'helm)

  (helm-mode 1)

  (setq helm-always-two-window nil)
  (setq helm-display-buffer-default-height 16)
  (setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

  (global-set-key (kbd "M-x") 'helm-M-x)
  (global-set-key (kbd "C-x C-b") 'helm-buffers-list)
  (global-set-key (kbd "C-x C-f") 'helm-find-files)


  (setq helm-buffer-max-length 30)

  (setq helm-boring-buffer-regexp-list
	(list
	 "\\*"
	 "\\*Echo Area"
	 "\\*Minibuf"
	 "\\*Shell Command Output\\*"
	 "\\*helm "
	 "\\*godoc "))
#+END_SRC

*** magit & forge
#+BEGIN_SRC emacs-lisp
  (global-set-key (kbd "C-x g") 'magit-status)

  (with-eval-after-load 'magit
    (require 'forge))
#+END_SRC
*** company
#+BEGIN_SRC emacs-lisp
  (require 'company)

  (company-quickhelp-mode 1)

  (setf company-idle-delay nil)

  (add-hook 'after-init-hook 'global-company-mode)

  (global-set-key (kbd "M-TAB") 'company-complete)
  (define-key emacs-lisp-mode-map (kbd "M-TAB") 'company-complete)

  (define-key company-active-map (kbd "C-n") 'company-select-next)
  (define-key company-active-map (kbd "C-p") 'company-select-previous)
  (define-key company-active-map (kbd "TAB") 'company-complete-selection)
  (define-key company-active-map [tab] 'company-complete-selection)
#+END_SRC
*** protobuf
#+BEGIN_SRC emacs-lisp
  (require 'protobuf-mode)

  (defun gearnode/protobuf-mode-init ()
    (c-add-style "protobuf"'((c-basic-offset . 2)) t))

  (add-hook 'protobuf-mode-hook 'gearnode/protobuf-mode-init)
#+END_SRC
*** markdown
#+BEGIN_SRC emacs-lisp
  (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
  (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  (add-to-list 'auto-mode-alist '("\\.mkd\\'" . markdown-mode))
#+END_SRC
*** json
#+BEGIN_SRC emacs-lisp
  (defun gearnode/json-mode-init ()
    (setq js-indent-level 2))

  (add-hook 'json-mode-hook 'gearnode/json-mode-init)
#+END_SRC
*** makefile
#+BEGIN_SRC emacs-lisp
  (defun gearnode/makefile-mode-init ()
    (setq tab-width 8))

  (add-hook 'makefile-mode-hook 'gearnode/makefile-mode-init)
#+END_SRC
*** go
#+BEGIN_SRC emacs-lisp
  (add-hook 'before-save-hook 'gofmt-before-save)
#+END_SRC
*** disable
#+BEGIN_SRC emacs-lisp
  (global-disable-mouse-mode)
  (setq-default global-disable-mouse-mode-lighter "")
#+END_SRC
*** yasnippet
#+BEGIN_SRC emacs-lisp
  (setq yas-snippet-dir
	(expand-file-name "snippets"
			  user-emacs-directory))
#+END_SRC
*** org
#+BEGIN_SRC emacs-lisp
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((C . t)
     (makefile . t)
     (shell . t)
     (sql . t)
     (ruby . t)))
#+END_SRC
*** projectile
#+BEGIN_SRC emacs-lisp
(require 'projectile)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)

(setq projectile-project-search-path '("~/workspace/"))

(require 'helm-projectile)
(helm-projectile-on)
#+END_SRC

*** hl-todo
#+BEGIN_SRC emacs-lisp
(global-hl-todo-mode)

(setq hl-todo-keyword-faces
      '(("TODO"  . "#FF0000")
        ("DEBUG" . "#1E90FF")
        ("XXX"   . "#1E90FF")))
#+END_SRC