commit | author | age
|
d070a7
|
1 |
#+TITLE: My Emacs configuration |
C |
2 |
* Windows dependencies |
|
3 |
Dependencies needed for Aspell, poppler PDF-tools, compilers and ghost-script provided by mingw64 |
|
4 |
#+BEGIN_SRC emacs-lisp |
|
5 |
(when (eq system-type 'windows-nt) |
db15ba
|
6 |
;; (add-to-list 'exec-path "C:/msys64/usr/bin") |
d070a7
|
7 |
(add-to-list 'exec-path "C:/msys64/mingw64/bin") |
C |
8 |
(add-to-list 'exec-path "c:/Program Files/Racket") |
6a3ca9
|
9 |
(add-to-list 'exec-path "c:/Users/joelg/TeXcount_3_1_1") |
C |
10 |
(add-to-list 'exec-path "c:/Program Files/gnuplot") |
d070a7
|
11 |
(setenv "PATH" (mapconcat #'identity exec-path path-separator))) |
C |
12 |
#+END_SRC |
|
13 |
|
|
14 |
* Aesthetic changes |
|
15 |
** Zenburn theme |
|
16 |
#+BEGIN_SRC emacs-lisp |
|
17 |
(use-package zenburn-theme |
|
18 |
:ensure t |
|
19 |
:config |
|
20 |
(load-theme 'zenburn t)) |
|
21 |
#+END_SRC |
|
22 |
** Default font |
|
23 |
#+BEGIN_SRC emacs-lisp |
|
24 |
(set-default-font "DejaVu Sans Mono-10") |
|
25 |
#+END_SRC |
|
26 |
* Writing requirements |
|
27 |
** Spellchecking |
|
28 |
#+BEGIN_SRC emacs-lisp |
|
29 |
(require 'ispell) |
|
30 |
(setq-default ispell-program-name "aspell") |
|
31 |
(add-hook 'latex-mode-hook 'flyspell-mode) |
|
32 |
(add-hook 'latex-mode-hook 'flyspell-buffer) |
|
33 |
(add-hook 'org-mode-hook 'flyspell-mode) |
|
34 |
(add-hook 'org-mode-hook 'flyspell-buffer) |
|
35 |
#+END_SRC |
|
36 |
|
|
37 |
** Switch-window |
|
38 |
Helps to change windows easily when many are open at once |
|
39 |
#+BEGIN_SRC emacs-lisp |
|
40 |
(use-package switch-window |
|
41 |
:ensure t |
|
42 |
:config |
|
43 |
(setq switch-window-input-style 'minibuffer) |
|
44 |
(setq switch-window-increase 4) |
|
45 |
(setq switch-window-threshold 2) |
|
46 |
(setq switch-window-shortcut-style 'qwerty) |
|
47 |
(setq switch-window-qwerty-shortcuts |
|
48 |
'("a" "s" "d" "f" "j" "k" "l" "i" "o")) |
|
49 |
:bind |
|
50 |
([remap other-window] . switch-window)) |
|
51 |
#+END_SRC |
|
52 |
** Go to new window when opened |
|
53 |
#+BEGIN_SRC emacs-lisp |
|
54 |
(defun split-and-follow-horizontally () |
|
55 |
(interactive) |
|
56 |
(split-window-below) |
|
57 |
(balance-windows) |
|
58 |
(other-window 1)) |
|
59 |
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally) |
|
60 |
|
|
61 |
(defun split-and-follow-vertically () |
|
62 |
(interactive) |
|
63 |
(split-window-right) |
|
64 |
(balance-windows) |
|
65 |
(other-window 1)) |
|
66 |
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically) |
|
67 |
#+END_SRC |
|
68 |
** PDF-tools |
|
69 |
#+BEGIN_SRC emacs-lisp |
|
70 |
(use-package pdf-tools |
|
71 |
:ensure t |
|
72 |
:config |
|
73 |
(pdf-tools-install)) |
|
74 |
|
|
75 |
#+END_SRC |
|
76 |
* Helm and projectile |
|
77 |
** Helm core |
|
78 |
#+BEGIN_SRC emacs-lisp |
|
79 |
(use-package helm-config |
|
80 |
:ensure helm |
|
81 |
:bind (("M-x" . helm-M-x) |
|
82 |
("C-x C-f" . helm-find-files) |
|
83 |
("M-y" . helm-show-kill-ring) |
|
84 |
("C-x b" . helm-mini) |
|
85 |
("C-c h o" . helm-occur)) |
|
86 |
:config |
|
87 |
(setq helm-M-x-fuzzy-match t) |
|
88 |
(setq helm-buffers-fuzzy-matching t |
|
89 |
helm-recentf-fuzzy-match t) |
|
90 |
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window |
|
91 |
helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source. |
|
92 |
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp. |
|
93 |
helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior> |
|
94 |
helm-ff-file-name-history-use-recentf t |
|
95 |
helm-echo-input-in-header-line t) |
|
96 |
(defun spacemacs//helm-hide-minibuffer-maybe () |
|
97 |
"Hide minibuffer in Helm session if we use the header line as input field." |
|
98 |
(when (with-helm-buffer helm-echo-input-in-header-line) |
|
99 |
(let ((ov (make-overlay (point-min) (point-max) nil nil t))) |
|
100 |
(overlay-put ov 'window (selected-window)) |
|
101 |
(overlay-put ov 'face |
|
102 |
(let ((bg-color (face-background 'default nil))) |
|
103 |
`(:background ,bg-color :foreground ,bg-color))) |
|
104 |
(setq-local cursor-type nil)))) |
|
105 |
(add-hook 'helm-minibuffer-set-up-hook |
|
106 |
'spacemacs//helm-hide-minibuffer-maybe) |
|
107 |
(helm-mode 1)) |
|
108 |
#+END_SRC |
|
109 |
** Projectile |
|
110 |
*** Enable it |
|
111 |
#+BEGIN_SRC emacs-lisp |
|
112 |
(use-package projectile |
|
113 |
:ensure t |
|
114 |
:bind ("C-c p" . projectile-command-map) |
1650a5
|
115 |
:diminish projectile-mode |
d070a7
|
116 |
:config |
C |
117 |
(projectile-global-mode) |
|
118 |
(setq projectile-completion-system 'helm) |
|
119 |
(setq projectile-indexing-method 'alien)) |
|
120 |
#+END_SRC |
|
121 |
*** Let it compile things |
|
122 |
#+BEGIN_SRC emacs-lisp |
|
123 |
(global-set-key (kbd "<f5>") 'projectile-compile-project) |
|
124 |
#+END_SRC |
|
125 |
*** Enable communication with helm |
|
126 |
#+BEGIN_SRC emacs-lisp |
|
127 |
(use-package helm-projectile |
|
128 |
:ensure t |
|
129 |
:config |
|
130 |
(helm-projectile-on)) |
|
131 |
#+END_SRC |
|
132 |
* Small tweaks |
|
133 |
** Remove startup screen |
|
134 |
#+BEGIN_SRC emacs-lisp |
|
135 |
(setq inhibit-startup-message t) |
|
136 |
#+END_SRC |
|
137 |
** Disable bell |
|
138 |
Bloody bell dings every time you hit a key too much |
|
139 |
#+BEGIN_SRC emacs-lisp |
|
140 |
(setq ring-bell-function 'ignore) |
|
141 |
#+END_SRC |
|
142 |
** Pretty symbols |
|
143 |
Why not? They make it look nice |
|
144 |
#+BEGIN_SRC emacs-lisp |
|
145 |
(when window-system |
|
146 |
(use-package pretty-mode |
|
147 |
:ensure t |
|
148 |
:diminish t |
|
149 |
:config |
|
150 |
(global-pretty-mode))) |
|
151 |
#+END_SRC |
|
152 |
** find file other window |
|
153 |
Lets it accept more than one file. Works recursively. |
|
154 |
#+BEGIN_SRC emacs-lisp |
|
155 |
(defadvice find-file-other-window (around find-files activate) |
|
156 |
(if (listp filename) |
|
157 |
(loop for f in filename do (find-file-other-window f wildcards)) |
|
158 |
ad-do-it)) |
|
159 |
#+END_SRC |
|
160 |
** Which key |
|
161 |
Helps to explain keybindings if you get lost |
|
162 |
#+BEGIN_SRC emacs-lisp |
|
163 |
(use-package which-key |
|
164 |
:ensure t |
|
165 |
:diminish which-key-mode |
|
166 |
:config |
|
167 |
(which-key-mode)) |
|
168 |
#+END_SRC |
|
169 |
** Go to this file |
|
170 |
#+BEGIN_SRC emacs-lisp |
|
171 |
(defun config-visit () |
|
172 |
(interactive) |
|
173 |
(find-file "~/.emacs.d/config.org")) |
|
174 |
(global-set-key (kbd "C-c e d") 'config-visit) |
|
175 |
#+END_SRC |
1650a5
|
176 |
** Go to init.el |
C |
177 |
#+BEGIN_SRC emacs-lisp |
|
178 |
(defun init-visit () |
|
179 |
(interactive) |
|
180 |
(find-file "~/.emacs.d/init.el")) |
|
181 |
(global-set-key (kbd "C-c e i") 'init-visit) |
|
182 |
#+END_SRC |
d070a7
|
183 |
** Reload configuration |
C |
184 |
#+BEGIN_SRC emacs-lisp |
|
185 |
(defun config-reload () |
|
186 |
"Reloads ~/.emacs.d/config.org at run time" |
|
187 |
(interactive) |
|
188 |
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) |
|
189 |
(global-set-key (kbd "C-c e r") 'config-reload) |
|
190 |
#+END_SRC |
|
191 |
** Smartparens |
|
192 |
Matches brackets automatically |
|
193 |
#+BEGIN_SRC emacs-lisp |
|
194 |
(use-package smartparens |
|
195 |
:ensure t |
|
196 |
:diminish smartparens-mode |
|
197 |
:config |
|
198 |
(progn |
|
199 |
(require 'smartparens-config) |
|
200 |
(smartparens-global-mode 1))) |
|
201 |
#+END_SRC |
|
202 |
** Rainbow |
|
203 |
Its a little gimmicky but its still cool |
|
204 |
#+BEGIN_SRC emacs-lisp |
|
205 |
(use-package rainbow-mode |
|
206 |
:ensure t |
1650a5
|
207 |
:diminish rainbow-mode |
d070a7
|
208 |
:init |
C |
209 |
(add-hook 'prog-mode-hook 'rainbow-mode)) |
|
210 |
#+END_SRC |
|
211 |
** Rainbow delimiters |
|
212 |
A bit more useful than above. |
|
213 |
Colours the brackets so that they stand out more. |
|
214 |
#+BEGIN_SRC emacs-lisp |
|
215 |
(use-package rainbow-delimiters |
|
216 |
:ensure t |
|
217 |
:init |
|
218 |
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) |
|
219 |
#+END_SRC |
|
220 |
** clean-aindent-mode |
|
221 |
Removes unnecessary white space |
|
222 |
#+BEGIN_SRC emacs-lisp |
|
223 |
(use-package clean-aindent-mode |
|
224 |
:ensure t |
|
225 |
:hook prog-mode) |
|
226 |
#+END_SRC |
|
227 |
Shows trailing white space |
|
228 |
#+BEGIN_SRC emacs-lisp |
|
229 |
(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1))) |
|
230 |
#+END_SRC |
|
231 |
** whitespace mode |
|
232 |
Reveals whitespace characters |
|
233 |
#+BEGIN_SRC emacs-lisp |
|
234 |
(global-set-key (kbd "C-c w") 'whitespace-mode) |
|
235 |
(add-hook 'diff-mode-hook (lambda () |
|
236 |
(setq-local whitespace-style |
|
237 |
'(face |
|
238 |
tabs |
|
239 |
tab-mark |
|
240 |
spaces |
|
241 |
space-mark |
|
242 |
trailing |
|
243 |
indentation::space |
|
244 |
indentation::tab |
|
245 |
newline |
|
246 |
newline-mark)) |
|
247 |
(whitespace-mode 1))) |
|
248 |
|
|
249 |
#+END_SRC |
|
250 |
** eldoc |
|
251 |
#+BEGIN_SRC emacs-lisp |
|
252 |
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode) |
|
253 |
(add-hook 'lisp-interaction-mode-hook 'eldoc-mode) |
|
254 |
(add-hook 'ielm-mode-hook 'eldoc-mode) |
|
255 |
#+END_SRC |
|
256 |
** key-freq |
|
257 |
collects interesting statistics |
|
258 |
#+BEGIN_SRC emacs-lisp |
|
259 |
(use-package keyfreq |
|
260 |
:ensure t |
|
261 |
:config |
|
262 |
(keyfreq-mode 1) |
|
263 |
(keyfreq-autosave-mode 1)) |
|
264 |
#+END_SRC |
|
265 |
** undo-tree |
|
266 |
A more advanced undo mechanism |
|
267 |
#+BEGIN_SRC emacs-lisp |
|
268 |
(use-package undo-tree |
|
269 |
:ensure t |
1650a5
|
270 |
:diminish undo-tree-mode |
d070a7
|
271 |
:config |
C |
272 |
(global-undo-tree-mode)) |
|
273 |
#+END_SRC |
|
274 |
** volatile highlights |
|
275 |
Colour the material just copied |
|
276 |
#+BEGIN_SRC emacs-lisp |
|
277 |
(use-package volatile-highlights |
|
278 |
:ensure t |
1650a5
|
279 |
:diminish volatile-highlights-mode |
d070a7
|
280 |
:config |
C |
281 |
(volatile-highlights-mode t)) |
|
282 |
#+END_SRC |
|
283 |
** Workgroups |
|
284 |
Open the pages when you quit |
|
285 |
#+BEGIN_SRC emacs-lisp |
|
286 |
(use-package workgroups2 |
|
287 |
:ensure t |
1650a5
|
288 |
:diminish workgroups-mode |
d070a7
|
289 |
:config |
C |
290 |
(workgroups-mode 1)) |
|
291 |
#+END_SRC |
|
292 |
** ibuffer |
|
293 |
#+BEGIN_SRC emacs-lisp |
|
294 |
(global-set-key (kbd "C-x C-b") 'ibuffer) |
|
295 |
(setq ibuffer-use-other-window t) |
|
296 |
#+END_SRC |
|
297 |
** hippie expand |
|
298 |
#+BEGIN_SRC emacs-lisp |
|
299 |
(global-set-key (kbd "M-/") 'hippie-expand) ;; replace dabbrev-expand |
|
300 |
(setq |
|
301 |
hippie-expand-try-functions-list |
|
302 |
'(try-expand-dabbrev ;; Try to expand word "dynamically", searching the current buffer. |
|
303 |
try-expand-dabbrev-all-buffers ;; Try to expand word "dynamically", searching all other buffers. |
|
304 |
try-expand-dabbrev-from-kill ;; Try to expand word "dynamically", searching the kill ring. |
|
305 |
try-complete-file-name-partially ;; Try to complete text as a file name, as many characters as unique. |
|
306 |
try-complete-file-name ;; Try to complete text as a file name. |
|
307 |
try-expand-all-abbrevs ;; Try to expand word before point according to all abbrev tables. |
|
308 |
try-expand-list ;; Try to complete the current line to an entire line in the buffer. |
|
309 |
try-expand-line ;; Try to complete the current line to an entire line in the buffer. |
|
310 |
try-complete-lisp-symbol-partially ;; Try to complete as an Emacs Lisp symbol, as many characters as unique. |
|
311 |
try-complete-lisp-symbol) ;; Try to complete word as an Emacs Lisp symbol. |
|
312 |
) |
|
313 |
#+END_SRC |
|
314 |
** Highlight line |
|
315 |
#+BEGIN_SRC emacs-lisp |
|
316 |
(global-hl-line-mode) |
|
317 |
#+END_SRC |
|
318 |
** Line numbers |
|
319 |
#+BEGIN_SRC emacs-lisp |
|
320 |
(add-hook 'prog-mode-hook 'linum-mode) |
|
321 |
#+END_SRC |
|
322 |
|
|
323 |
** Garbage collection |
|
324 |
starts garbage collection every 100MB |
|
325 |
#+BEGIN_SRC emacs-lisp |
|
326 |
(setq gc-cons-threshold 100000000) |
|
327 |
#+END_SRC |
|
328 |
|
|
329 |
** Kill ring |
|
330 |
Changes the kill ring size to 5000. |
|
331 |
#+BEGIN_SRC emacs-lisp |
|
332 |
(setq global-mark-ring-max 5000 |
|
333 |
mark-ring-max 5000 |
|
334 |
mode-require-final-newline t |
|
335 |
kill-ring-max 5000 |
|
336 |
kill-whole-line t) |
|
337 |
#+END_SRC |
|
338 |
** Coding style |
|
339 |
#+BEGIN_SRC emacs-lisp |
|
340 |
(setq c-default-style "linux") |
|
341 |
#+END_SRC |
|
342 |
|
|
343 |
** Coding system |
|
344 |
#+BEGIN_SRC emacs-lisp |
|
345 |
(set-terminal-coding-system 'utf-8) |
|
346 |
(set-keyboard-coding-system 'utf-8) |
|
347 |
(set-language-environment "UTF-8") |
|
348 |
(prefer-coding-system 'utf-8) |
|
349 |
(setq-default indent-tabs-mode t) |
|
350 |
(delete-selection-mode) |
|
351 |
(global-set-key (kbd "RET") 'newline-and-indent) |
|
352 |
#+END_SRC |
|
353 |
** Move to beginning of line ignoring whitespace |
|
354 |
Move point back to indentation of beginning of line. |
|
355 |
|
|
356 |
Move point to the first non-whitespace character on this line. |
|
357 |
If point is already there, move to the beginning of the line. |
|
358 |
Effectively toggle between the first non-whitespace character and |
|
359 |
the beginning of the line. |
|
360 |
|
|
361 |
If ARG is not nil or 1, move forward ARG - 1 lines first. If |
|
362 |
point reaches the beginning or end of the buffer, stop there. |
|
363 |
#+BEGIN_SRC emacs-lisp |
|
364 |
(defun prelude-move-beginning-of-line (arg) |
|
365 |
(interactive "^p") |
|
366 |
(setq arg (or arg 1)) |
|
367 |
|
|
368 |
;; Move lines first |
|
369 |
(when (/= arg 1) |
|
370 |
(let ((line-move-visual nil)) |
|
371 |
(forward-line (1- arg)))) |
|
372 |
|
|
373 |
(let ((orig-point (point))) |
|
374 |
(back-to-indentation) |
|
375 |
(when (= orig-point (point)) |
|
376 |
(move-beginning-of-line 1)))) |
|
377 |
|
|
378 |
(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line) |
|
379 |
#+END_SRC |
|
380 |
** Indent region or buffer |
|
381 |
#+BEGIN_SRC emacs-lisp |
|
382 |
(defun indent-region-or-buffer () |
|
383 |
"Indent a region if selected, otherwise the whole buffer." |
|
384 |
(interactive) |
|
385 |
(unless (member major-mode prelude-indent-sensitive-modes) |
|
386 |
(save-excursion |
|
387 |
(if (region-active-p) |
|
388 |
(progn |
|
389 |
(indent-region (region-beginning) (region-end)) |
|
390 |
(message "Indented selected region.")) |
|
391 |
(progn |
|
392 |
(indent-buffer) |
|
393 |
(message "Indented buffer."))) |
|
394 |
(whitespace-cleanup)))) |
|
395 |
|
|
396 |
(global-set-key (kbd "C-c i") 'indent-region-or-buffer) |
|
397 |
#+END_SRC |
|
398 |
** Tramp |
|
399 |
#+BEGIN_SRC emacs-lisp |
|
400 |
(when (eq system-type 'windows-nt) |
0b811a
|
401 |
(setq tramp-default-method "pscp")) |
d070a7
|
402 |
(setq password-cache-expiry nil) |
C |
403 |
#+END_SRC |
|
404 |
|
|
405 |
* Mode line tweaks |
|
406 |
Diminish is used but is included in init.el such that it can be used throughout this document |
|
407 |
** Spaceline |
|
408 |
A little easier to read than the default emacs mode line |
|
409 |
#+BEGIN_SRC emacs-lisp |
|
410 |
(use-package spaceline |
|
411 |
:ensure t |
|
412 |
:config |
|
413 |
(require 'spaceline-config) |
|
414 |
(setq spaceline-buffer-encoding-abbrev-p t) |
|
415 |
(setq spaceline-line-column-p t) |
|
416 |
(setq spaceline-line-p t) |
|
417 |
(setq powerline-default-separator (quote arrow)) |
|
418 |
(spaceline-spacemacs-theme)) |
|
419 |
#+END_SRC |
|
420 |
** No separator |
|
421 |
#+BEGIN_SRC emacs-lisp |
|
422 |
(setq powerline-default-seperator nil) |
|
423 |
#+END_SRC |
|
424 |
* Programming tweaks |
|
425 |
** Yasnippet |
|
426 |
#+BEGIN_SRC emacs-lisp |
1650a5
|
427 |
(use-package yasnippet |
C |
428 |
:ensure t |
|
429 |
:diminish yas-minor-mode |
|
430 |
:config |
|
431 |
(use-package yasnippet-snippets |
|
432 |
:ensure t) |
|
433 |
(yas-reload-all) |
|
434 |
(yas-global-mode 1)) |
d070a7
|
435 |
#+END_SRC |
C |
436 |
** flycheck |
|
437 |
#+BEGIN_SRC emacs-lisp |
|
438 |
(use-package flycheck |
|
439 |
:ensure t) |
|
440 |
#+END_SRC |
|
441 |
*** flycheck-pos-tip |
|
442 |
#+BEGIN_SRC emacs-lisp |
|
443 |
(use-package flycheck-pos-tip |
|
444 |
:ensure t |
|
445 |
:after flycheck |
|
446 |
:config |
|
447 |
(flycheck-pos-tip-mode)) |
|
448 |
#+END_SRC |
|
449 |
** Company |
|
450 |
Company is auto-complete for emacs |
|
451 |
#+BEGIN_SRC emacs-lisp |
|
452 |
(use-package company |
|
453 |
:ensure t |
1650a5
|
454 |
:diminish company-mode |
d070a7
|
455 |
:config |
1650a5
|
456 |
(add-hook 'prog-mode-hook 'company-mode) |
d070a7
|
457 |
(setq company-idle-delay 0) |
C |
458 |
(setq company-minimum-prefix-length 3)) |
|
459 |
#+END_SRC |
|
460 |
** Magit |
|
461 |
#+BEGIN_SRC emacs-lisp |
|
462 |
(use-package magit |
|
463 |
:ensure t |
|
464 |
:commands magit-get-top-dir |
|
465 |
:bind ("C-x g" . magit-status) |
|
466 |
:init |
|
467 |
(progn |
|
468 |
;; make magit status go full-screen but remember previous window |
|
469 |
;; settings |
|
470 |
;; from: http://whattheemacsd.com/setup-magit.el-01.html |
|
471 |
(defadvice magit-status (around magit-fullscreen activate) |
|
472 |
(window-configuration-to-register :magit-fullscreen) |
|
473 |
ad-do-it |
|
474 |
(delete-other-windows)) |
|
475 |
|
|
476 |
;; Close popup when committing - this stops the commit window |
|
477 |
;; hanging around |
|
478 |
;; From: http://git.io/rPBE0Q |
|
479 |
(defadvice git-commit-commit (after delete-window activate) |
|
480 |
(delete-window)) |
|
481 |
|
|
482 |
(defadvice git-commit-abort (after delete-window activate) |
|
483 |
(delete-window)) |
|
484 |
|
|
485 |
:config |
|
486 |
(progn |
|
487 |
;; restore previously hidden windows |
|
488 |
(defadvice magit-quit-window (around magit-restore-screen activate) |
|
489 |
(let ((current-mode major-mode)) |
|
490 |
ad-do-it |
|
491 |
;; we only want to jump to register when the last seen buffer |
|
492 |
;; was a magit-status buffer. |
|
493 |
(when (eq 'magit-status-mode current-mode) |
|
494 |
(jump-to-register :magit-fullscreen))))) |
|
495 |
|
|
496 |
;; magit settings |
|
497 |
(setq |
|
498 |
;; don't put "origin-" in front of new branch names by default |
|
499 |
magit-default-tracking-name-function 'magit-default-tracking-name-branch-only |
|
500 |
;; open magit status in same window as current buffer |
|
501 |
magit-status-buffer-switch-function 'switch-to-buffer |
|
502 |
;; highlight word/letter changes in hunk diffs |
|
503 |
magit-diff-refine-hunk t |
|
504 |
;; ask me if I want to include a revision when rewriting |
|
505 |
magit-rewrite-inclusive 'ask |
|
506 |
;; ask me to save buffers |
|
507 |
magit-save-some-buffers t |
|
508 |
;; pop the process buffer if we're taking a while to complete |
|
509 |
magit-process-popup-time 10 |
|
510 |
;; ask me if I want a tracking upstream |
|
511 |
magit-set-upstream-on-push 'askifnotset |
|
512 |
))) |
|
513 |
#+END_SRC |
|
514 |
** CEDET |
|
515 |
*** semantic |
|
516 |
#+BEGIN_SRC emacs-lisp |
|
517 |
(use-package semantic |
|
518 |
:config |
|
519 |
(global-semanticdb-minor-mode 1) |
|
520 |
(global-semantic-idle-scheduler-mode 1) |
|
521 |
(global-semantic-idle-summary-mode 1) |
|
522 |
(semantic-mode 1)) |
|
523 |
#+END_SRC |
|
524 |
*** EDE |
|
525 |
#+BEGIN_SRC emacs-lisp |
|
526 |
(use-package ede |
|
527 |
:config |
|
528 |
(global-ede-mode t)) |
|
529 |
#+END_SRC |
|
530 |
*** gdb-many-windows |
|
531 |
#+BEGIN_SRC emacs-lisp |
|
532 |
(setq |
|
533 |
;; use gdb-many-windows by default |
|
534 |
gdb-many-windows t |
|
535 |
|
|
536 |
;; Non-nil means display source file containing the main routine at startup |
|
537 |
gdb-show-main t) |
|
538 |
#+END_SRC |
|
539 |
*** Semantic refactor |
|
540 |
#+BEGIN_SRC emacs-lisp |
|
541 |
(use-package srefactor |
|
542 |
:ensure t |
|
543 |
:bind (("M-RET o" . 'srefactor-lisp-one-line) |
|
544 |
("M-RET m" . 'srefactor-lisp-format-sexp) |
|
545 |
("M-RET d" . 'srefactor-lisp-format-defun) |
|
546 |
("M-RET b" . 'srefactor-lisp-format-buffer) |
|
547 |
:map c-mode-base-map |
|
548 |
("M-RET" . 'srefactor-refactor-at-point) |
|
549 |
:map c++-mode-map |
|
550 |
("M-RET" . 'srefactor-refactor-at-point))) |
|
551 |
#+END_SRC |
1650a5
|
552 |
** Language specific configs |
C |
553 |
*** C/C++ |
|
554 |
**** yasnippet |
|
555 |
#+BEGIN_SRC emacs-lisp |
|
556 |
(add-hook 'c++-mode-hook 'yas-minor-mode) |
|
557 |
(add-hook 'c-mode-hook 'yas-minor-mode) |
|
558 |
#+END_SRC |
|
559 |
**** flycheck clang |
|
560 |
#+BEGIN_SRC emacs-lisp |
|
561 |
(use-package flycheck-clang-analyzer |
|
562 |
:ensure t |
|
563 |
:config |
|
564 |
(with-eval-after-load 'flycheck |
|
565 |
(require 'flycheck-clang-analyzer) |
|
566 |
(flycheck-clang-analyzer-setup))) |
|
567 |
#+END_SRC |
|
568 |
**** company |
|
569 |
#+BEGIN_SRC emacs-lisp |
|
570 |
(use-package company-c-headers |
db15ba
|
571 |
:ensure t |
C |
572 |
:after company |
|
573 |
:config |
|
574 |
(add-hook 'c++-mode-hook 'company-mode) |
|
575 |
(add-hook 'c-mode-hook 'company-mode)) |
1650a5
|
576 |
|
C |
577 |
(use-package company-irony |
|
578 |
:ensure t |
|
579 |
:config |
|
580 |
(add-to-list 'company-backends '(company-c-headers |
db15ba
|
581 |
company-dabbrev-code |
C |
582 |
company-irony))) |
1650a5
|
583 |
|
C |
584 |
(use-package irony |
|
585 |
:ensure t |
|
586 |
:config |
db15ba
|
587 |
(setq w32-pipe-read-delay 0) |
1650a5
|
588 |
(add-hook 'c++-mode-hook 'irony-mode) |
C |
589 |
(add-hook 'c-mode-hook 'irony-mode) |
|
590 |
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) |
|
591 |
#+END_SRC |
|
592 |
*** emacs-lisp |
|
593 |
**** eldoc |
|
594 |
#+BEGIN_SRC emacs-lisp |
|
595 |
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode) |
|
596 |
#+END_SRC |
|
597 |
**** yasnippet |
|
598 |
#+BEGIN_SRC emacs-lisp |
|
599 |
(add-hook 'emacs-lisp-mode-hook 'yas-minor-mode) |
|
600 |
#+END_SRC |
|
601 |
**** company |
|
602 |
#+BEGIN_SRC emacs-lisp |
|
603 |
(add-hook 'emacs-lisp-mode-hook 'company-mode) |
|
604 |
|
|
605 |
(use-package slime |
|
606 |
:ensure t |
|
607 |
:config |
|
608 |
(setq inferior-lisp-program "/usr/bin/sbcl") |
|
609 |
(setq slime-contribs '(slime-fancy))) |
|
610 |
|
|
611 |
(use-package slime-company |
|
612 |
:ensure t |
|
613 |
:init |
|
614 |
(require 'company) |
|
615 |
(slime-setup '(slime-fancy slime-company))) |
|
616 |
#+END_SRC |
|
617 |
*** x86 |
|
618 |
**** x86-lookup |
|
619 |
#+BEGIN_SRC emacs-lisp |
|
620 |
(use-package x86-lookup |
|
621 |
:ensure t |
|
622 |
:init |
|
623 |
(setq x86-lookup-pdf "D:/Coding/x86-instructions.pdf") |
|
624 |
:bind ("C-h x" . x86-lookup)) |
|
625 |
#+END_SRC |
|
626 |
*** Latex |
|
627 |
**** AucTex |
|
628 |
#+BEGIN_SRC emacs-lisp |
|
629 |
(use-package tex |
|
630 |
:ensure auctex |
|
631 |
:config |
|
632 |
(setq TeX-auto-save t) |
|
633 |
(setq TeX-parse-self t) |
|
634 |
(setq doc-view-ghostscript-program "c:/msys64/mingw64/bin/gswin32c.exe") |
|
635 |
(setq preview-gs-command "c:/msys64/mingw64/bin/gs.exe")) |
|
636 |
#+END_SRC |
|
637 |
**** Company |
|
638 |
#+BEGIN_SRC emacs-lisp |
|
639 |
(use-package company-math |
|
640 |
:ensure t |
|
641 |
:after company |
|
642 |
:config |
|
643 |
(add-to-list 'company-backends 'company-math-symbols-unicode)) |
|
644 |
#+END_SRC |
|
645 |
**** Preview pane |
|
646 |
#+BEGIN_SRC emacs-lisp |
|
647 |
(use-package latex-preview-pane |
|
648 |
:ensure t |
|
649 |
:config |
|
650 |
(latex-preview-pane-enable)) |
|
651 |
#+END_SRC |
6a3ca9
|
652 |
**** TeXcount |
C |
653 |
Word counts in latex |
|
654 |
#+BEGIN_SRC emacs-lisp |
|
655 |
(defun texcount () |
|
656 |
(interactive) |
|
657 |
(let* |
|
658 |
( (this-file (buffer-file-name)) |
|
659 |
(enc-str (symbol-name buffer-file-coding-system)) |
|
660 |
(enc-opt |
|
661 |
(cond |
|
662 |
((string-match "utf-8" enc-str) "-utf8") |
|
663 |
((string-match "latin" enc-str) "-latin1") |
|
664 |
("-encoding=guess") |
|
665 |
) ) |
|
666 |
(word-count |
|
667 |
(with-output-to-string |
|
668 |
(with-current-buffer standard-output |
|
669 |
(call-process "texcount" nil t nil "-0" enc-opt this-file) |
|
670 |
) ) ) ) |
|
671 |
(message word-count) |
|
672 |
) ) |
|
673 |
(add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-c c") 'texcount))) |
|
674 |
(add-hook 'latex-mode-hook (lambda () (define-key latex-mode-map (kbd "C-c c") 'texcount))) |
|
675 |
#+END_SRC |
|
676 |
|
1650a5
|
677 |
*** PlantUML |
C |
678 |
#+BEGIN_SRC emacs-lisp |
|
679 |
(use-package plantuml-mode |
|
680 |
:ensure t |
|
681 |
:init |
|
682 |
(setq plantuml-jar-path "c:/ProgramData/chocolatey/lib/plantuml/tools/plantuml.jar")) |
|
683 |
#+END_SRC |
0b811a
|
684 |
* Org mode |
d070a7
|
685 |
** Up to date org |
C |
686 |
#+BEGIN_SRC emacs-lisp |
|
687 |
(use-package org |
|
688 |
:ensure t |
|
689 |
:pin org) |
|
690 |
#+END_SRC |
|
691 |
** Small tweaks |
|
692 |
#+BEGIN_SRC emacs-lisp |
|
693 |
(setq org-src-fontify-natively t) |
|
694 |
(setq org-src-tab-acts-natively t) |
|
695 |
(setq org-confirm-babel-evaluate nil) |
|
696 |
(setq org-export-with-smart-quotes t) |
|
697 |
(setq org-src-window-setup 'current-window) |
|
698 |
(add-hook 'org-mode-hook 'org-indent-mode) |
1650a5
|
699 |
(diminish 'org-indent-mode) |
C |
700 |
(diminish 'visual-line-mode) |
d070a7
|
701 |
#+END_SRC |
C |
702 |
** Line wrapping |
|
703 |
#+BEGIN_SRC emacs-lisp |
|
704 |
(add-hook 'org-mode-hook |
|
705 |
'(lambda () |
|
706 |
(visual-line-mode 1))) |
|
707 |
#+END_SRC |
|
708 |
** org-bullets |
|
709 |
#+BEGIN_SRC emacs-lisp |
|
710 |
(use-package org-bullets |
|
711 |
:ensure t |
|
712 |
:config |
|
713 |
(add-hook 'org-mode-hook (lambda () (org-bullets-mode)))) |
|
714 |
#+END_SRC |