-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
299 lines (237 loc) · 7.71 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
;;; init --- My Emacs Config
;;; -*- mode: lisp -*-
;;; Commentary:
;;; Code:
;; Customize BS
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
;; Load my-packages for require
(add-to-list 'load-path "~/.emacs.d/my-packages")
(require 'my-packages)
(require 'c-style)
;; Increase GC Threshold - Speeds up startup
(setq-default gc-cons-threshold 10000000)
;;; Theme and Looks
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/tomorrow-theme")
(add-to-list 'load-path "~/.emacs.d/themes/tomorrow-theme")
(load-theme 'tomorrow-night t)
;; Font
(set-face-attribute 'default nil :font "Iosevka Type Light-9")
;; Transparency
(set-frame-parameter (selected-frame) 'alpha '(85 85))
(add-to-list 'default-frame-alist '(alpha 85 85))
;; Disable background color so transparency is nicer
(defun on-after-init ()
(unless (display-graphic-p (selected-frame))
(set-face-background 'default "unspecified-bg" (selected-frame))))
(add-hook 'window-setup-hook 'on-after-init)
;;; Basic Stuff
;; Make yes or no prompts be y or n prompts
(fset 'yes-or-no-p 'y-or-n-p)
;; Disable menu-bars, scroll-bars, and other nonsense
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
;; Show what column I'm in
(column-number-mode t)
;; Useful Mouse
(xterm-mouse-mode t)
;; Show Matching parens
(setq show-paren-delay 0) ; Quickly
(show-paren-mode t)
(setq-default inhibit-startup-message t ; I hate the startup message
make-backup-files nil ; I hate these more
vc-follow-symlinks t ; Why would you not do this?
frame-title-format "%@%b%* - emacs" ; Useful window title
gdb-many-windows t ; GDB Mode is Awesome
diff-switches "-u"
scroll-step 10
cua-mode nil ; C-c,v,x is for the un-enlightened
cua-auto-tabify-rectangles nil)
;; Auto indent
(define-key global-map (kbd "RET") 'newline-and-indent)
;;; Org-Mode Stuff
;; Syntax Highlight Source blocks
(setq org-src-fontify-natively t)
;; http://orgmode.org/worg/org-contrib/org-collector.html
(require 'org-collector)
;; Adds links to man pages through C-c C-l
(require 'org-man)
;; http://orgmode.org/worg/org-contrib/org-wikinodes.html
(require 'org-wikinodes)
;;; Plugins
;; Aggressive Indent Mode
(global-aggressive-indent-mode 1)
(add-to-list 'aggressive-indent-excluded-modes 'html-mode)
;; Auctex
(setq TeX-auto-save t)
(setq TeX-parse-self t)
;; Clean AIndent Mode
(set 'clean-aindent-is-simple-indent t)
;; (add-hook 'prog-mode-hook 'clean-aindent-mode)
;; Company
(add-hook 'after-init-hook 'global-company-mode)
;; Delight
(delight '((abbrev-mode)
(evil-commentary-mode "" evil-commentary)
(aggressive-indent-mode "" aggressive-indent)
(color-identifiers-mode "" rainbow-identifiers)
(company-mode "" company)
(flycheck-mode "" flycheck)
(helm-mode "")
(indent-guide-mode " »|" indent-guide)
(projectile-mode "" projectile)
(projectile-rails-mode " RoR" projectile-rails)
(global-whitespace-mode "" whitespace)
(subword-mode " -,_" subword)
(undo-tree-mode "" undo-tree)
(vi-tilde-fringe-mode "" vi-tilde-fringe)
(ws-butler-mode "" ws-butler)
))
;; Flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
(setq-default flycheck-disabled-checkers '(ruby-reek))
;; flycheck-rubocoprc (concat (file-name-as-directory (ignore-errors projectile-project-root)) ".rubocop.yml")
;; Function Args
(fa-config-default)
(set-default 'semantic-case-fold t)
;; Helm
(helm-mode 1)
(setq helm-autoresize-mode t)
(setq helm-buffer-max-length 40)
(global-set-key (kbd "M-x") 'helm-M-x)
;; Indent-guide
(indent-guide-global-mode)
;; (Relative) Line Numbers
(require 'relative-linum)
(global-linum-mode t)
;; Org-Bullets
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
;; Projectile
(projectile-mode +1)
;; Rainbow-delimiters
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
;; Rainbow-identifiers
(add-hook 'prog-mode-hook 'rainbow-identifiers-mode)
;; Semantic
(semantic-mode t)
(global-semanticdb-minor-mode t)
(global-semantic-idle-scheduler-mode t)
(global-semantic-idle-summary-mode t)
(global-semantic-stickyfunc-mode t)
(semantic-add-system-include "/usr/include")
;; Smart-mode-line
(sml/setup)
(sml/apply-theme 'dark)
;; VI Fringe Tilde
(global-vi-tilde-fringe-mode t)
;; Whitespace
(add-hook 'after-init-hook 'global-whitespace-mode)
(setq whitespace-style (list 'face 'trailing))
;; WS Butler
(add-hook 'prog-mode-hook 'ws-butler-mode)
;;; C/C++
(defun my:c/c++-hook ()
(setq my-c-include-paths (split-string
"/usr/local/include
/usr/include"))
(setq c-default-style "bsd-knf"
c-basic-offset 4
whitespace-style (list 'face 'trailing)
flycheck-gcc-include-path my-c-include-paths
flycheck-gcc-openmp t
flycheck-disabled-checkers '(c/c++-clang) ;; Clang is stupid
)
(which-function-mode t)
;; Company additions that are c/c++ mode specific
(add-to-list 'company-backends 'company-c-headers)
(define-key c-mode-map [(tab)] 'company-complete)
(define-key c++-mode-map [(tab)] 'company-complete)
)
(add-hook 'c-mode-hook 'my:c/c++-hook)
;;; Lisps
;; ELisp
(defun my-elisp-hook()
(turn-on-eldoc-mode)
)
(add-hook 'emacs-lisp-mode-hook 'my-elisp-hook)
(setq inferior-lisp-program "sbcl")
;; Sly
(setq sly-complete-symbol-function 'sly-flex-completions)
;;; Ruby
(defun my:ruby-hook ()
(inf-ruby-minor-mode +1)
(projectile-rails-mode)
(subword-mode +1))
(add-hook 'ruby-mode-hook 'my:ruby-hook)
;;; EVIL Stuff
(setq evil-want-integration t) ;; Needed for evil-collection
(setq evil-want-keybinding nil) ;; Needed for evil-collection
(evil-mode 1)
;; Evil-Collection
(evil-collection-init)
;; Evil-Commentary
(evil-commentary-mode)
;; Evil-Matchit
(global-evil-matchit-mode 1)
;; Evil-Exchange
(setq evil-exchange-key (kbd "gx"))
(evil-exchange-install)
;; Evil-Surround
(global-evil-surround-mode 1)
;; Evil-Leader
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
;; Emacs Shortcuts
"m" 'execute-extended-command
";" 'eval-expression
"hv" 'describe-variable
"hk" 'describe-key
;; Highlight-symbol
"hs" 'auto-highlight-symbol-mode
;; Multiple-Cursors
"cn" 'mc/mark-next-like-this
"cp" 'mc/mark-previous-like-this
"ca" 'mc/mark-all-like-this
;; Buffer/File operations
"fs" 'whitespace-cleanup
"t" projectile-command-map
;; Evil-Numbers maps
"na" 'evil-numbers/inc-at-pt
"nx" 'evil-numbers/dec-at-pt
;; Rainbow-Mode
"rr" 'rainbow-mode
"rs" 'fancy-narrow-to-region
"re" 'fancy-widen
;; Splits
"sv" 'evil-window-vsplit
"sh" 'evil-window-split
"sc" 'evil-quit
"so" 'delete-other-windows
;; Window Controls
"ww" 'evil-window-next
"wh" 'evil-window-left
"wj" 'evil-window-down
"wk" 'evil-window-up
"wl" 'evil-window-right
;; Expand-Region
"v" 'er/expand-region
)
;; EVIL Bindings
;; Swap v and C-v, block-visual is much more useful
(define-key evil-normal-state-map (kbd "v") 'evil-visual-block)
(define-key evil-normal-state-map (kbd "C-v") 'evil-visual-char)
;; Set j/k to do gj/gk
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "g j") 'evil-next-line)
(define-key evil-normal-state-map (kbd "g k") 'evil-previous-line)
;; Function args
(define-key evil-insert-state-map (kbd "C-h") 'moo-complete)
;;; init.el ends here