-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
315 lines (251 loc) · 9.55 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
;;; init.el --- my emacs init things
;;; Commentary: hi!
;; Some helper fns. Blatantly copied from overtone's live-coding
;; Create a variable to store the path to this dotfile directory
;; (Usually ~/.emacs.d)
;;; Code:
(setq dotfiles-dir (file-name-directory
(or (buffer-file-name) load-file-name)))
;; Create helper fns for loading dotfile paths and files
(defun add-dotfile-path (p)
(add-to-list 'load-path (concat dotfiles-dir p)))
(defun load-dotfile (f)
(load-file (concat dotfiles-dir f)))
(defun my-add-path (path-element)
"Add the specified path element to the Emacs PATH"
(interactive "Enter directory to be added to path: ")
(if (file-directory-p path-element)
(setenv "PATH"
(concat (expand-file-name path-element)
path-separator (getenv "PATH")))))
;; ;; init the packages system
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
;; ;; ;; Add in your own as you wish:
(defvar my-packages '(starter-kit
starter-kit-lisp
color-theme
markdown-mode
auto-complete
multiple-cursors
cider
ac-cider
clojure-mode
clj-refactor
flx-ido
column-enforce-mode
powerline
dakrone-theme
leuven-theme
gist
eclim)
"A list of packages to ensure are installed at launch.")
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(setq mac-allow-anti-aliasing 't)
(set-frame-font "-apple-Anonymous_Pro-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1")
(set-frame-font "-apple-PT_Mono-medium-normal-normal-*-13-*-*-*-m-0-iso10646-1")
;; custom paths added to the default PATH
(my-add-path "/usr/local/bin/")
(my-add-path "/Users/ulises/bin/")
(let ((path (shell-command-to-string ". ~/.zshrc; echo -n $PATH")))
(setenv "PATH" path)
(setq exec-path
(append
(split-string-and-unquote path ":")
exec-path)))
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
;;; ac-complete customisations
(setq ac-auto-start 4)
(global-set-key (kbd "M-TAB") 'ac-start)
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-modes 'clojure-mode)
;;; set the indentation to spaces *AFTER* loading python things :/
(setq-default indent-tabs-mode nil)
;;; delete trailing space everywhere!
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;;; delete trailing space in various languages
(add-hook 'python-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(delete-trailing-whitespace))))))
(add-hook 'clojure-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(delete-trailing-whitespace))))))
;; ;; generic stuff global to pretty much everything
(menu-bar-mode)
(setq-default show-trailing-whitespace t)
;; multiple-cursors
(require 'multiple-cursors)
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C-c C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-previous-like-this)
;; (autoload 'jedi:setup "jedi" nil t)
;; (setq jedi:setup-keys t)
;; (add-hook 'python-mode-hook 'jedi:setup)
(global-set-key (kbd "C-c f .") 'flymake-goto-next-error)
(global-set-key (kbd "C-c f ,") 'flymake-goto-prev-error)
(put 'narrow-to-region 'disabled nil)
;; flx stuff
(require 'flx-ido)
(ido-mode 1)
(ido-everywhere 1)
(flx-ido-mode 1)
;; disable ido faces to see flx highlights.
;; (setq ido-use-faces nil)
;; clj-refactor
(require 'clj-refactor)
(add-hook 'clojure-mode-hook (lambda ()
(clj-refactor-mode 1)
;; insert keybinding setup here
(cljr-add-keybindings-with-prefix "C-c")
(yas/minor-mode 1)
(auto-complete-mode)))
(add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)
(eval-after-load 'clojure-mode
'(define-key clojure-mode-map (kbd "C-c a l") 'align-cljlet))
;; ;; cider tuning
(setq cider-repl-pop-to-buffer-on-connect nil)
(setq cider-popup-stacktraces nil)
(setq cider-repl-popup-stacktraces t)
(setq cider-auto-select-error-buffer t)
(setq cider-repl-print-length 100) ; the default is nil, no limit
(setq cider-repl-wrap-history t)
(add-hook 'cider-repl-mode-hook 'paredit-mode)
(add-hook 'cider-repl-mode-hook 'auto-complete-mode)
(require 'ac-cider)
(add-hook 'cider-mode-hook 'ac-flyspell-workaround)
(add-hook 'cider-mode-hook 'ac-cider-setup)
(add-hook 'cider-repl-mode-hook 'ac-cider-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'cider-mode))
(defun set-auto-complete-as-completion-at-point-function ()
(setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
(setq ac-quick-help-delay 0.5)
;; (require 'ac-nrepl)
;; (add-hook 'cider-repl-mode-hook 'ac-nrepl-setup)
;; (add-hook 'cider-mode-hook 'ac-nrepl-setup)
;; (eval-after-load "auto-complete"
;; '(add-to-list 'ac-modes 'cider-repl-mode))
;; (defun set-auto-complete-as-completion-at-point-function ()
;; (setq completion-at-point-functions '(auto-complete)))
;; (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
;; (add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
;; (add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
(eval-after-load "cider"
'(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-popup-doc))
(add-hook 'clojure-mode-hook 'column-enforce-mode)
(require 'powerline)
(powerline-default-theme)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x b") 'helm-mini)
;; (global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "M-i") 'helm-swoop)
(global-set-key (kbd "C-c M-i") 'helm-multi-swoop-all)
(load-theme 'leuven t)
;; Haskell
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(eval-after-load 'haskell-mode
'(define-key haskell-mode-map [f8] 'haskell-navigate-imports))
(let ((my-cabal-path (expand-file-name "~/.cabal/bin")))
(setenv "PATH" (concat my-cabal-path ":" (getenv "PATH")))
(add-to-list 'exec-path my-cabal-path))
(custom-set-variables
'(haskell-process-type 'cabal-repl)
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t)
'(haskell-tags-on-save t))
(eval-after-load 'haskell-mode
'(progn
(define-key haskell-mode-map
(kbd "C-c C-l")
'haskell-process-load-or-reload)
(define-key haskell-mode-map
(kbd "C-c C-z")
'haskell-interactive-switch)
(define-key haskell-mode-map
(kbd "C-c C-n C-t")
'haskell-process-do-type)
(define-key haskell-mode-map
(kbd "C-c C-n C-i")
'haskell-process-do-info)
(define-key haskell-mode-map
(kbd "C-c C-n C-c")
'haskell-process-cabal-build)
(define-key haskell-mode-map
(kbd "C-c C-n c")
'haskell-process-cabal)
(define-key haskell-mode-map
(kbd "SPC")
'haskell-mode-contextual-space)
(define-key haskell-mode-map
(kbd "C-c C-o")
'haskell-compile)))
(eval-after-load 'haskell-cabal
'(progn
(define-key haskell-cabal-mode-map
(kbd "C-c C-z")
'haskell-interactive-switch)
(define-key haskell-cabal-mode-map
(kbd "C-c C-k")
'haskell-interactive-mode-clear)
(define-key haskell-cabal-mode-map
(kbd "C-c C-c")
'haskell-process-cabal-build)
(define-key haskell-cabal-mode-map
(kbd "C-c c")
'haskell-process-cabal)
(define-key haskell-cabal-mode-map
(kbd "C-c C-o")
'haskell-compile)))
;; ibuffer bindings
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; eclim
(require 'eclim)
(global-eclim-mode)
(require 'eclimd)
;; custom eclim/eclipse paths
(custom-set-variables
'(eclim-eclipse-dirs '("~/eclipse"))
'(eclim-executable "~/eclipse/eclim")
'(eclimd-default-workspace "~/workspace/"))
;; displaying compilation error messages in the echo area
(setq help-at-pt-display-when-idle t)
(setq help-at-pt-timer-delay 0.1)
(help-at-pt-set-timer)
;; add the emacs-eclim source
(require 'ac-emacs-eclim-source)
(ac-emacs-eclim-config)
;; bind hippie expand
(global-set-key "\M- " 'hippie-expand)
;; start the emacs server
(server-start)
;; ;;; init.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes (quote ("96b023d1a6e796bab61b472f4379656bcac67b3af4e565d9fb1b6b7989356610" default))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)