forked from flyingmachine/emacs-for-clojure
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.el
More file actions
296 lines (235 loc) · 9.52 KB
/
init.el
File metadata and controls
296 lines (235 loc) · 9.52 KB
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
;;;;
;; Packages
;;;;
;; Define package repositories
(require 'package)
;; (add-to-list 'package-archives
;; '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("tromey" . "http://tromey.com/elpa/") t)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
;; ("marmalade" . "http://marmalade-repo.org/packages/")
;; ("melpa" . "http://melpa-stable.milkbox.net/packages/")))
;; Load and activate emacs packages. Do this first so that the
;; packages are loaded before you start trying to modify them.
;; This also sets the load path.
(package-initialize)
;; Download the ELPA archive description if needed.
;; This informs Emacs about the latest versions of all packages, and
;; makes them available for download.
(when (not package-archive-contents)
(package-refresh-contents))
;; Define he following variables to remove the compile-log warnings
;; when defining ido-ubiquitous
(defvar ido-cur-item nil)
(defvar ido-default-item nil)
(defvar ido-cur-list nil)
(defvar predicate nil)
(defvar inherit-input-method nil)
;; The packages you want installed. You can also install these
;; manually with M-x package-install
;; Add in your own as you wish:
(defvar my-packages
'(;; makes handling lisp expressions much, much easier
;; Cheatsheet: http://www.emacswiki.org/emacs/PareditCheatsheet
paredit
;; key bindings and code colorization for Clojure
;; https://github.com/clojure-emacs/clojure-mode
clojure-mode
;; extra syntax highlighting for clojure
clojure-mode-extra-font-locking
;; integration with a Clojure REPL
;; https://github.com/clojure-emacs/cider
cider
;; allow ido usage in as many contexts as possible. see
;; customizations/navigation.el line 23 for a description
;; of ido
ido-ubiquitous
;; Enhances M-x to allow easier execution of commands. Provides
;; a filterable list of possible commands in the minibuffer
;; http://www.emacswiki.org/emacs/Smex
smex
;; project navigation
projectile
;; colorful parenthesis matching
rainbow-delimiters
;; edit html tags like sexps
tagedit
;; git integration
magit))
;; On OS X, an Emacs instance started from the graphical user
;; interface will have a different environment than a shell in a
;; terminal window, because OS X does not run a shell during the
;; login. Obviously this will lead to unexpected results when
;; calling external utilities like make from Emacs.
;; This library works around this problem by copying important
;; environment variables from the user's shell.
;; https://github.com/purcell/exec-path-from-shell
(if (eq system-type 'darwin)
(add-to-list 'my-packages 'exec-path-from-shell))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
;; Place downloaded elisp files in ~/.emacs.d/vendor. You'll then be able
;; to load them.
;;
;; For example, if you download yaml-mode.el to ~/.emacs.d/vendor,
;; then you can add the following code to this file:
;;
;; (require 'yaml-mode)
;; (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
;;
;; Adding this code will make Emacs enter yaml mode whenever you open
;; a .yml file
(add-to-list 'load-path "~/.emacs.d/vendor")
;;;;
;; Customization
;;;;
;; Add a directory to our load path so that when you `load` things
;; below, Emacs knows where to look for the corresponding file.
(add-to-list 'load-path "~/.emacs.d/customizations")
;; Sets up exec-path-from-shell so that Emacs will use the correct
;; environment variables
(load "shell-integration.el")
;; These customizations make it easier for you to navigate files,
;; switch buffers, and choose options from the minibuffer.
(load "navigation.el")
;; These customizations change the way emacs looks and disable/enable
;; some user interface elements
(load "ui.el")
;; These customizations make editing a bit nicer.
(load "editing.el")
;; Hard-to-categorize customizations
(load "misc.el")
;; For editing lisps
(load "elisp-editing.el")
;; Langauage-specific
(load "setup-clojure.el")
(load "setup-js.el")
(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.
'(ansi-color-faces-vector
[default bold shadow italic underline bold bold-italic bold])
'(blink-cursor-blinks 0)
'(blink-cursor-delay 0.2)
'(cider-boot-parameters "repl -s -b localhost wait")
'(cider-repl-display-help-banner nil)
'(coffee-tab-width 2)
'(column-number-mode t)
'(cursor-type (quote bar))
'(custom-enabled-themes (quote (solarized-light)))
'(custom-safe-themes
(quote
("d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" default)))
'(mac-command-modifier (quote super))
'(mac-option-modifier (quote meta))
'(magit-fetch-arguments (quote ("--prune")))
'(magit-push-always-verify nil)
'(nrepl-sync-request-timeout 30)
'(package-selected-packages
(quote
(projectile clojure-mode cider rjsx-mode kubernetes yaml-mode textmate terraform-mode tagedit solarized-theme smex slim-mode shrink-whitespace rainbow-delimiters powerline org magit ido-ubiquitous helm-projectile grizzl expand-region exec-path-from-shell dockerfile-mode company clojure-mode-extra-font-locking clj-refactor ace-window)))
'(ruby-align-to-stmt-keywords (quote (def if case)))
'(ruby-insert-encoding-magic-comment nil)
'(safe-local-variable-values
(quote
((cljr-suppress-middleware-warnings . t)
(cider-default-cljs-repl . "shadow")
(cider-preferred-build-tool . "shadow-cljs")
(cider-preferred-build-tool . "lein")
(cider-preferred-build-tool . "clojure-cli")
(cider-default-cljs-repl . "figwheel-main")
(cider-default-cljs-repl quote figwheel-main)
(eval progn
(make-variable-buffer-local
(quote cider-jack-in-nrepl-middlewares))
(add-to-list
(quote cider-jack-in-nrepl-middlewares)
"shadow.cljs.devtools.server.nrepl/middleware")))))
'(split-height-threshold 200)
'(truncate-partial-width-windows t))
(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.
)
(tool-bar-mode -1)
(defun switch-to-previous-buffer ()
"Switch to most recent buffer. Repeated calls toggle back and forth between the most recent two buffers."
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
;; set key binding
(global-set-key (kbd "C-`") 'switch-to-previous-buffer)
(electric-indent-mode +1)
;; (textmate-mode)
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "C-x g") 'magit-status)
(with-eval-after-load 'magit
(magit-change-popup-key 'magit-fetch-popup :action ?u ?f)
(magit-change-popup-key 'magit-pull-popup :action ?u ?F)
(magit-change-popup-key 'magit-rebase-popup :action ?e ?r)
(magit-change-popup-key 'magit-push-popup :action ?p ?P))
(toggle-frame-fullscreen)
(global-set-key (kbd "s-r") 'ace-window)
(setq aw-dispatch-always 't)
(global-set-key (kbd "s-1") (kbd "s-r 1"))
(global-set-key (kbd "s-2") (kbd "s-r 2"))
(global-set-key (kbd "s-3") (kbd "s-r 3"))
(global-set-key (kbd "s-4") (kbd "s-r 4"))
(global-set-key (kbd "s-5") (kbd "s-r 5"))
(global-set-key (kbd "s-6") (kbd "s-r 6"))
(global-set-key (kbd "s-7") (kbd "s-r 7"))
(global-set-key (kbd "s-8") (kbd "s-r 8"))
(global-set-key (kbd "s-9") (kbd "s-r 9"))
(global-set-key (kbd "s-k") 'kill-this-buffer)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-c C->") 'mc/skip-to-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/skip-to-previous-like-this)
(global-set-key (kbd "<s-return>") (kbd "C-e C-m"))
(global-set-key (kbd "<S-s-return>") (kbd "C-p C-e C-m"))
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
(require 'helm-config)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x b") 'helm-mini)
(require 'helm-projectile)
(helm-projectile-on)
;;keep cursor at same position when scrolling
(setq scroll-preserve-screen-position 1)
;;scroll window up/down by one line
(global-set-key (kbd "M-n") (kbd "C-u 1 C-v"))
(global-set-key (kbd "M-p") (kbd "C-u 1 M-v"))
(global-set-key (kbd "M-\\") 'shrink-whitespace)
(global-set-key (kbd "s-u") 'revert-buffer)
(avy-setup-default)
(global-set-key (kbd "s-d") 'avy-goto-word-1)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
;; set maximum indentation for description lists
(setq org-list-description-max-indent 5)
;; prevent demoting heading also shifting text inside sections
(setq org-adapt-indentation nil)
(setq org-agenda-files (list "~/org/work.org"))
(setq org-default-notes-file "~/org/work.org")
(define-key global-map "\C-cc" 'org-capture)
(setq org-element-use-cache nil)
(delete-selection-mode t)
(eval-after-load 'inf-ruby
'(define-key inf-ruby-minor-mode-map
(kbd "C-c C-s") 'inf-ruby-console-auto))
(set-frame-font "Fira Code")
(mac-auto-operator-composition-mode)
(require 'direnv)
(direnv-mode)