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