1
- (setq package-archives '((" ELPA" . " http://tromey.com/elpa/" )
2
- (" gnu" . " http://elpa.gnu.org/packages/" )
3
- (" marmalade" . " http://marmalade-repo.org/packages/" )))
1
+ (require 'package )
4
2
5
- (when (load (expand-file-name " ~/.emacs.d/packages/elpa/package.el" ))
6
- (package-initialize ))
3
+ (package-initialize )
7
4
8
- (add-to-list 'load-path " ~/.emacs.d/" )
9
- (require 'mpereira-defuns )
5
+ (add-to-list 'package-archives '(" melpa" . " http://melpa.org/packages/" ))
10
6
11
- ; ; Paredit.
12
- (add-to-list 'load-path " ~/.emacs.d/packages/paredit" )
13
- (require 'paredit )
14
- (paredit-mode t )
7
+ (unless package-archive-contents
8
+ (package-refresh-contents ))
15
9
16
- ; ; Lose the UI.
17
- (if (fboundp 'scroll-bar-mode ) (scroll-bar-mode -1 ))
18
- (if (fboundp 'tool-bar-mode ) (tool-bar-mode -1 ))
19
- (if (fboundp 'menu-bar-mode ) (menu-bar-mode -1 ))
10
+ (unless (package-installed-p 'use-package )
11
+ (package-refresh-contents )
12
+ (package-install 'use-package ))
20
13
21
- ; ; Quiel startup.
14
+ (eval-when-compile
15
+ (require 'use-package ))
16
+
17
+ ; ; Color theme ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
+
19
+ (use-package ample-theme
20
+ :ensure t
21
+ :config
22
+ (add-hook 'after-init-hook (lambda () (load-theme 'ample t ))))
23
+
24
+ ; ; Helper functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25
+
26
+ ; ; https://www.emacswiki.org/emacs/DescribeThingAtPoint
27
+ (defun describe-thing-at-point ()
28
+ " Show the documentation of the Elisp function and variable near point.
29
+ This checks in turn:
30
+ -- for a function name where point is
31
+ -- for a variable name where point is
32
+ -- for a surrounding function call"
33
+ (interactive )
34
+ (let (sym)
35
+ (cond ((setq sym (ignore-errors
36
+ (with-syntax-table emacs-lisp-mode-syntax-table
37
+ (save-excursion
38
+ (or (not (zerop (skip-syntax-backward " _w" )))
39
+ (eq (char-syntax (char-after (point ))) ?w )
40
+ (eq (char-syntax (char-after (point ))) ?_ )
41
+ (forward-sexp -1 ))
42
+ (skip-chars-forward " `'" )
43
+ (let ((obj (read (current-buffer ))))
44
+ (and (symbolp obj) (fboundp obj) obj))))))
45
+ (describe-function sym))
46
+ ((setq sym (variable-at-point )) (describe-variable sym))
47
+ ((setq sym (function-at-point)) (describe-function sym)))))
48
+
49
+ ; ; FIXME: popup is showing at random positions.
50
+ ; ; FIXME: help-xref-interned creates a help buffer.
51
+ (defun describe-thing-at-point-in-popup ()
52
+ (interactive )
53
+ (let* ((thing (symbol-at-point ))
54
+ (help-xref-following t )
55
+ (content (with-temp-buffer
56
+ (help-mode )
57
+ (help-xref-interned thing)
58
+ (buffer-string ))))
59
+ (pos-tip-show content nil nil nil 999 )))
60
+
61
+ ; ; Options ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62
+
63
+ (menu-bar-mode -1 )
64
+ (scroll-bar-mode -1 )
65
+ (tool-bar-mode -1 )
22
66
(setq inhibit-startup-echo-area-message t )
23
67
(setq inhibit-startup-message t )
24
68
25
- (global-font-lock-mode t )
69
+ (require 'linum )
70
+ (add-hook 'prog-mode-hook 'linum-mode )
71
+
72
+ (require 'uniquify )
73
+ (setq uniquify-buffer-name-style 'forward )
74
+
75
+ (require 'saveplace )
76
+ (setq-default save-place t )
77
+
78
+ (require 'whitespace )
79
+ (setq whitespace-style '(face lines-tail trailing))
80
+ (global-whitespace-mode t )
81
+ (setq-default show-trailing-whitespace t )
82
+
83
+ ; ; https://github.com/technomancy/better-defaults
84
+ (setq-default indent-tabs-mode nil )
85
+ (setq-default tab-width 2 )
86
+ (setq select-enable-clipboard t
87
+ select-enable-primary t
88
+ save-interprogram-paste-before-kill t
89
+ apropos-do-all t
90
+ mouse-yank-at-point t
91
+ require-final-newline t
92
+ load-prefer-newer t
93
+ save-place-file (concat user-emacs-directory " places" )
94
+ backup-directory-alist `((" ." . ,(concat user-emacs-directory
95
+ " backups" ))))
96
+
97
+ ; ; general ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
98
+
99
+ (use-package general
100
+ :ensure t )
101
+
102
+ ; ; pos-tip ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
103
+
104
+ (use-package pos-tip
105
+ :ensure t )
106
+
107
+ ; ; aggresssive-indent ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108
+
109
+ (use-package aggressive-indent
110
+ :ensure t
111
+ :config
112
+ (add-hook 'prog-mode-hook 'aggressive-indent-mode ))
113
+
114
+ ; ; Lispy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
+
116
+ (use-package lispy
117
+ :ensure t
118
+ :config
119
+ (add-hook 'emacs-lisp-mode-hook 'lispy-mode ))
120
+
121
+ ; ; Lispyville ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
122
+
123
+ (use-package lispyville
124
+ :ensure t
125
+ :after evil lispy
126
+ :config
127
+ (add-hook 'lispy-mode-hook 'lispyville-mode )
128
+
129
+ (evil-define-key 'normal global-map
130
+ (kbd " y" ) 'lispyville-yank
131
+ (kbd " d" ) 'lispyville-delete
132
+ (kbd " c" ) 'lispyville-change
133
+ (kbd " x" ) 'lispyville-delete-char-or-splice
134
+ (kbd " Y" ) 'lispyville-yank-line
135
+ (kbd " D" ) 'lispy-kill
136
+ (kbd " C" ) 'lispyville-change-line
137
+ (kbd " X" ) 'lispyville-delete-char-or-splice-backwards
138
+ (kbd " B" ) 'lispyville-backward-sexp
139
+ ; ; FIXME: W
140
+ (kbd " W" ) 'lispyville-forward-sexp
141
+ (kbd " (" ) 'lispyville-backward-up-list
142
+ (kbd " )" ) 'lispyville-up-list
143
+ ; ; FIXME: barfs and slurps
144
+ (kbd " >)" ) 'lispyville->
145
+ (kbd " <)" ) 'lispyville-<
146
+ (kbd " <(" ) 'lispy-slurp
147
+ (kbd " >(" ) 'lispy-barf
148
+ (kbd " |" ) 'lispy-split
149
+ (kbd " _" ) 'lispy-join
150
+ (kbd " <f" ) 'lispyville-move-up
151
+ (kbd " >f" ) 'lispyville-move-down )
152
+
153
+ (evil-define-key 'visual global-map
154
+ (kbd " y" ) 'lispyville-yank
155
+ (kbd " d" ) 'lispyville-delete
156
+ (kbd " c" ) 'lispyville-change
157
+ (kbd " Y" ) 'lispyville-yank-line
158
+ (kbd " D" ) 'lispy-kill
159
+ (kbd " C" ) 'lispyville-change-line
160
+ (kbd " B" ) 'lispyville-backward-sexp
161
+ ; ; FIXME: W
162
+ (kbd " W" ) 'lispyville-forward-sexp
163
+ (kbd " (" ) 'lispyville-backward-up-list
164
+ (kbd " )" ) 'lispyville-up-list )
165
+
166
+ (evil-define-key 'insert global-map
167
+ (kbd " ESC" ) 'lispyville-normal-state )
168
+
169
+ (evil-leader/set-key
170
+ " R" 'lispy-raise-sexp ))
171
+
172
+ ; ; Auto-Complete ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
173
+
174
+ (use-package auto-complete
175
+ :ensure t
176
+ :config
177
+ (ac-config-default)
178
+ (ac-set-trigger-key " TAB" )
179
+ (setq ac-auto-start nil )
180
+ (setq ac-use-quick-help t )
181
+ (setq ac-quick-help-delay 0.5 )
182
+ (setq ac-use-menu-map t )
183
+ (define-key ac-menu-map " \C -j" 'ac-next )
184
+ (define-key ac-menu-map " \C -k" 'ac-previous ))
185
+
186
+ ; ; Which-key ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187
+
188
+ (use-package which-key
189
+ :ensure t )
190
+
191
+ ; ; Magit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
192
+
193
+ (use-package magit
194
+ :ensure t
195
+ :after evil-leader
196
+ :config
197
+ (evil-leader/set-key
198
+ " gs" 'magit-status ))
199
+
200
+ ; ; Evil ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
201
+
202
+ (use-package evil
203
+ :ensure t
204
+ :init
205
+ (setq evil-extra-operator-eval-key (kbd " ge" ))
206
+ :config
207
+ (add-hook 'prog-mode-hook 'evil-extra-operator-mode )
208
+
209
+ (add-hook
210
+ 'evil-mode-hook
211
+ (lambda ()
212
+ (setq evil-motion-state-modes (append evil-emacs-state-modes
213
+ evil-motion-state-modes))
214
+ (setq evil-emacs-state-modes nil )
215
+
216
+ (setq evil-shift-width 2 )
217
+
218
+ (define-key evil-normal-state-map (kbd " ;" ) 'evil-ex )
219
+ (define-key evil-normal-state-map (kbd " :" ) 'evil-repeat-find-char )
220
+
221
+ (evil-define-key 'normal global-map
222
+ (kbd " C-h" ) 'evil-window-left
223
+ (kbd " C-j" ) 'evil-window-down
224
+ (kbd " C-k" ) 'evil-window-up
225
+ (kbd " C-l" ) 'evil-window-right
226
+ (kbd " C-S-k" ) 'describe-thing-at-point
227
+ (kbd " K" ) 'describe-thing-at-point-in-popup )))
228
+
229
+ (add-hook
230
+ 'occur-mode-hook
231
+ (lambda ()
232
+ (evil-add-hjkl-bindings occur-mode-map 'emacs
233
+ (kbd " /" ) 'evil-search-forward
234
+ (kbd " j" ) 'evil-search-next
235
+ (kbd " k" ) 'evil-search-previous
236
+ (kbd " C-d" ) 'evil-scroll-down
237
+ (kbd " C-u" ) 'evil-scroll-up
238
+ (kbd " C-w C-w" ) 'other-window )))
239
+
240
+ (evil-mode t )
26
241
27
- ; ; Show line numbers.
28
- (global-linum-mode t )
29
- ; ; Show column number.
30
- (column-number-mode 1 )
31
- ; ; Highlight matching parentheses when the point is on them.
32
- (show-paren-mode 1 )
242
+ (use-package evil-magit
243
+ :after magit
244
+ :ensure t )
33
245
34
- ; ; Don't use tabs for indentation.
35
- (setq c-basic-indent 2 )
36
- (setq tab-width 2 )
37
- (setq indent-tabs-mode nil )
246
+ (use-package evil-escape
247
+ :ensure t )
38
248
39
- ; ; Give a boost to emacs's poor completion engine.
40
- (setq ido-enable-flex-matching t )
41
- (setq ido-everywhere t )
42
- (ido-mode 1 )
249
+ (use-package evil-nerd-commenter
250
+ :ensure t
251
+ :config
252
+ (evil-define-key 'normal global-map
253
+ (kbd " gc" ) 'evilnc-comment-operator ))
43
254
44
- (setq whitespace-style '(face trailing lines-tail tabs tabs-mark))
45
- (global-whitespace-mode 1 )
255
+ (use-package evil-surround
256
+ :ensure t
257
+ :config
258
+ (global-evil-surround-mode t ))
46
259
47
- (require 'mpereira-evil )
48
- (require 'mpereira-erlang )
260
+ (use-package evil-leader
261
+ :ensure t
262
+ :config
263
+ (global-evil-leader-mode)
264
+ (evil-leader/set-leader " ," )
265
+ (evil-leader/set-key
266
+ " ," 'mode-line-other-buffer
267
+ " dk" 'describe-key
268
+ " df" 'describe-function
269
+ " dv" 'describe-variable
270
+ " b" 'switch-to-buffer
271
+ " w" 'save-buffer
272
+ " q" 'evil-quit
273
+ " hs" 'split-window-vertically
274
+ " vs" 'split-window-horizontally )))
0 commit comments