-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
377 lines (329 loc) · 11.7 KB
/
init.el
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
;; ********************************************************************************************************************
;; Basic configuration settings and use package configuration
(setq delete-old-versions -1 ; delete excess backup versions silently
version-control t ; use version control
vc-make-backup-files t ; make backups file even when in version controlled dir
backup-directory-alist `(("." . "~/.emacs.d/backups")) ; which directory to put backups file
vc-follow-symlinks t ; don't ask for confirmation when opening symlinked file
auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)) ;transform backups file name
inhibit-splash-screen t
inhibit-startup-echo-area-message t
inhibit-startup-message t
ring-bell-function 'ignore ; silent bell when you make a mistake
coding-system-for-read 'utf-8 ; use utf-8 by default
coding-system-for-write 'utf-8
sentence-end-double-space nil ; sentence SHOULD end with only a point.
default-fill-column 80 ; toggle wrapping text at the 80th character
windmove-wrap-around t ; wrap aronud when navigating between windows
mac-option-modifier 'meta
mac-command-modifier 'super
mac-pass-control-to-system nil
default-input-method "MacOSX"
frame-title-format nil
use-dialog-box nil
custom-file "~/.emacs.d/custom.el")
(load custom-file)
(setq-default indent-tabs-mode nil)
;; Load files when changed on disk
(global-auto-revert-mode t)
;; Disable unecessary menus
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode 1)
;; Line numbers, word wrapping and such
(global-linum-mode 1)
(visual-line-mode 1)
(global-hl-line-mode)
;; Whitespace settings
(setq whitespace-style '(face tabs tab-mark trailing)
mode-require-final-newline t)
(global-whitespace-mode 1)
(add-hook 'before-save-hook 'whitespace-cleanup)
;; Configure font
(add-to-list 'default-frame-alist
'(font . "Office Code Pro-13:weight=normal"))
;; Better window management
(defadvice split-window (after move-point-to-new-window activate)
"Moves the point to the newly created window after splitting."
(other-window 1))
(winner-mode 1)
;; Configure and install use-package
(require 'package)
(setq package-enable-at-startup nil) ; tells emacs not to load any packages before starting up
;; the following lines tell emacs where on the internet to look up
;; for new packages.
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents) ; upgrage packages archive
(package-install 'use-package)) ; and install the most recent version of use-package
(require 'use-package)
;; ********************************************************************************************************************
;; PATH from shell
(use-package exec-path-from-shell
:ensure t
:demand
:init
(setq exec-path-from-shell-check-startup-files nil)
:config
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)))
(use-package uniquify
:config
(setq uniquify-buffer-name-style 'forward))
(use-package nord-theme
:ensure t
:demand
:config
(load-theme 'nord t))
(use-package telephone-line
:ensure t
:demand
:init
(setq telephone-line-lhs
'((evil . (telephone-line-evil-tag-segment))
(accent . (telephone-line-vc-segment
telephone-line-process-segment))
(nil . (telephone-line-file-name-absolute-path-segment
telephone-line-minor-mode-segment))))
(setq telephone-line-rhs
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-major-mode-segment))
(evil . (telephone-line-airline-position-segment))))
(setq telephone-line-height 24
telephone-line-subseparator-faces '((evil . nil)
(accent . nil)
(nil . accent))
telephone-line-evil-use-short-tag t)
:config
(telephone-line-mode 1))
;; Keybindings and descriptions with general and which-key
;; Keep general loading here, for it sets the :general keyword for use-package
(use-package general
:ensure t
:config
(general-evil-setup t) ;Generate vim like setters for general, like nmap)
(nmap
"s-s" 'save-buffer
"s-v" 'evil-paste-after)
;; Global prefix key definitions spanning multiple packages
(nmap
:prefix "SPC"
"t" '(nil :which-key "toggle")
"h" '(nil :which-key "help")
"hk" '(describe-key :which-key "describe-key")
"hv" '(describe-variable :which-key "describe-variable")
"hf" '(describe-function :which-key "describe-function")
"hd" '(apropos-documentation :which-key "documentation")))
(use-package delight
:ensure t)
(use-package which-key
:ensure t
:delight
:config
(which-key-mode)
(which-key-setup-minibuffer))
(use-package evil
:ensure t
:demand
:config
(evil-mode 1))
(use-package evil-goggles
:ensure t
:demand
:after (evil evil-smartparens)
:init
(setq evil-goggles-enable-paste nil
evil-goggles-enable-delete nil
evil-goggles-blocking-duration 0.100)
:config
(set-face-attribute 'evil-goggles-default-face nil :inherit 'isearch-fail)
(setq evil-goggles--commands
(append evil-goggles--commands
'((evil-sp-yank :face evil-goggles-yank-face :switch evil-goggles-enable-yank :advice evil-goggles--generic-async-advice)
(evil-sp-yank-line :face evil-goggles-yank-face :switch evil-goggles-enable-yank :advice evil-goggles--generic-async-advice)
(evil-sp-delete :face evil-goggles-delete-face :switch evil-goggles-enable-delete :advice evil-goggles--generic-blocking-advice)
(evil-sp-delete-char :face evil-goggles-delete-face :switch evil-goggles-enable-delete :advice evil-goggles--generic-blocking-advice)
(evil-sp-delete-line :face evil-goggles-delete-face :switch evil-goggles-enable-delete :advice evil-goggles--delete-line-advice)
(evil-sp-change :face evil-goggles-change-face :switch evil-goggles-enable-change :advice evil-goggles--generic-blocking-advice)
(evil-sp-change-line :face evil-goggles-change-face :switch evil-goggles-enable-change :advice evil-goggles--generic-blocking-advice)
(evil-sp-change-whole-line :face evil-goggles-change-face :switch evil-goggles-enable-change :advice evil-goggles--generic-blocking-advice))))
)
(use-package helm
:ensure t
:delight
:general
("M-x" #'helm-M-x
"C-x C-f" #'helm-find-files)
(:keymaps 'helm-map
"<tab>" #'helm-execute-persistent-action
"C-i" #'helm-execute-persistent-action)
(nmap
:prefix "SPC"
"SPC" '(helm-find-files :which-key "helm find files")
"/i" '(helm-imenu :which-key "helm imenu"))
:init
(setq helm-move-to-line-cycle-in-source nil ; move to end or beginning of source when reaching top or bottom of source.
helm-ff-file-name-history-use-recentf t
helm-mode-fuzzy-match t
helm-completion-in-region-fuzzy-match t
helm-M-x-fuzzy-match t)
:config
(require 'helm-config)
(helm-mode 1)
(helm-autoresize-mode 1))
(use-package company
:ensure t
:delight " c"
:config
(global-company-mode))
(use-package avy
:ensure t
:general
(nmap
:prefix "SPC"
"a" '(avy-goto-char-timer :which-key "Ace jump")))
;; Parens editing
(use-package smartparens
:ensure t
:hook ((prog-mode . smartparens-strict-mode)
(prog-mode . show-smartparens-mode))
:general
(nmap
:prefix "SPC"
"s" '(nil :which-key "smartparens")
"sk" '(sp-splice-sexp-killing-forward :which-key "Splice killing forward")
"sj" '(sp-splice-sexp-killing-backward :which-key "Splice killing backward"))
:config
(require 'smartparens-config)
(sp-pair "(" ")" :wrap "C-(") ;parens wrapping in evil mode
(sp-pair "\"" "\"" :wrap "C-\"")
(sp-pair "{" "}" :wrap "C-{")
(sp-use-paredit-bindings))
(use-package evil-smartparens
:ensure t
:after smartparens
:hook (smartparens-enabled . evil-smartparens-mode))
(use-package rainbow-delimiters
:ensure t
:hook (prog-mode . rainbow-delimiters-mode)
:init
(set-face-background 'show-paren-match "#4B5266")
(set-face-attribute 'show-paren-match nil :underline nil))
(use-package rainbow-mode
:ensure t
:config
(rainbow-mode))
(use-package ag
:ensure t
:init
(setq aq-highlight-search t))
(use-package helm-ag
:ensure t
:after ag)
(use-package projectile
:ensure t
:delight '(:eval (concat " P[" (projectile-project-name) "]"))
:general
(nmap
:keymaps 'projectile-mode-map
:prefix "SPC"
"p" '(projectile-command-map :which-key "projectile"))
:init
(projectile-mode 1))
(use-package helm-projectile
:ensure t
:after projectile
:init
(setq projectile-completion-system 'helm
projectile-switch-project-action 'helm-projectile)
:config
(helm-projectile-on))
(use-package neotree
:ensure t
:general
(nmap
:keymaps 'neotree-mode-map
"<tab>" #'neotree-quick-look
"q" #'neotree-hide
"RET" #'neotree-enter
"g" #'neotree-refresh
"j" #'neotree-next-line
"k" #'neotree-previous-line
"A" #'neotree-stretch-toggle
"H" #'neotree-hidden-file-toggle)
(nmap
:keymaps 'neotree-mode-map
:prefix "SPC"
"tn" '(neotree-toggle :which-key "neotree toggle"))
(nmap
:prefix "SPC"
"tn" '(neotree-toggle :which-key "neotree toggle"))
:init
(setq neo-theme 'nerd
neo-smart-open t))
(use-package magit
:ensure t
:defer t
:general
(nmap
:prefix "SPC"
"g" '(nil :which-key "magit")
"gg" '(magit-status :which-key "magit status"))
:init
(setq magit-last-seen-setup-instructions "1.4.0"
magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
:config
(use-package evil-magit :ensure t))
(use-package clojure-mode
:ensure t
:hook ((clojure-mode-hook . eldoc-mode))
:mode "\\.clj\\'")
(use-package cider
:ensure t
:after clojure-mode
:hook ((clojure-mode-hook . cider-mode))
:general
(nmap
:keymaps 'clojure-mode-map
:prefix ","
"c" '(nil :which-key "cider")
"cj" '(cider-jack-in-clj&cljs :which-key "cider-jack-in-clj&cljs"))
(nmap
:keymaps 'cider-mode-map
:prefix ","
"e" '(nil :which-key "eval")
"ep" '(cider-eval-last-sexp :which-key "eval-last-sexp")
"en" '(cider-eval-ns-form :which-key "eval-ns-form")
"ur" '(my-clojure/cider-reset :which-key "user-reset")
"g" '(nil :which-key "cider-goto")
"gj" '(cider-find-dwim :which-key "jump-to-def"))
:init
(setq cider-repl-display-help-banner nil
cider-repl-pop-to-buffer-on-connect nil
cider-repl-result-prefix ";; => "
cider-interactive-eval-result-prefix ";; => ")
:config
(defun my-clojure/cider-reset ()
(interactive)
(cider-ensure-connected)
(with-current-buffer (cider-current-repl-buffer)
(goto-char (point-max))
(insert "(user/reset)")
(cider-repl-return))
(message "(user/reset) called")))
(use-package cider-eval-sexp-fu
:ensure t
:after cider
:init
(set-face-background 'eval-sexp-fu-flash nil)
(set-face-foreground 'eval-sexp-fu-flash nil)
(set-face-attribute 'eval-sexp-fu-flash nil :inherit 'isearch-fail))
(use-package clj-refactor
:ensure t
:after clojure-mode
:hook ((clojure-mode-hook . clj-refactor-mode)))