-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
376 lines (305 loc) · 11.4 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
;;; Package --- Summary
;; This is the initialization file automatically loaded by emacs. This file has
;; been customized to my personal preferences.
;;; Commentary:
;; Compatibility: Emacs 24.x Older versions should be supported with minor
;; changes.
;; The following plugins are enabled by this configuration:
;; - yasnippet
;; Within the .emacs.d directory, there should be the following folders:
;; - backups: location of backup files
;; - auto-saves: location of auto-save files
;; - plugins: location of plugins
;; - elpa: plugins installed via the Emacs package manager
;; This file is broken up as follows:
;; - load paths
;; - mode configuration
;; - custom code
;; - Emacs personalization
;; inline comments should explain what is going on.
;;load paths. These are the locations of various Emacs plugins
;; I like to keep Lisp code separated by placing each plugin into it's own
;; directory. That makes it easier to manage moving forward.
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(add-to-list 'load-path "~/.emacs.d/plugins/color-theme-6.6.0/")
(add-to-list 'load-path "~/.emacs.d/plugins/unbound/")
(add-to-list 'load-path "~/.emacs.d/plugins/autopair")
;(add-to-list 'load-path "~/.emacs.d/plugins/smartparens")
(add-to-list 'load-path "~/.emacs.d/plugins/graphviz/")
(add-to-list 'load-path "~/.emacs.d/plugins/linum/")
(add-to-list 'load-path "~/.emacs.d/plugins/markdownmode/")
;(add-to-list 'load-path "~/.emacs.d/plugins/auto-complete-1.3.1")
(add-to-list 'load-path "~/.emacs.d/plugins/window-number")
(add-to-list 'load-path "~/.emacs.d/plugins/fci")
(add-to-list 'load-path "~/.emacs.d/plugins/virtualenvwrapper")
(add-to-list 'load-path "~/.emacs.d/plugins/Pymacs")
(add-to-list 'load-path "~/.emacs.d/plugins/ac-etags")
;(add-to-list 'load-path "~/.emacs.d/plugins/pymacs")
(setq py-install-directory "~/.emacs.d/plugins/python-mode.el-6.1.3")
(add-to-list 'load-path py-install-directory)
;;; MODE SECTION *******************
;;
;; This section contains requirements and configuration for plugin
;PACKAGE
; Important keys and commands:
; - package-list-packages
;; disabled for Emacs 24.x. Older versions require package.el
;(when
; (load
; (expand-file-name "~/.emacs.d/elpa/package.el"))
; (package-initialize))
(require 'package)
;; elpa archive is installed by default, add melpa, melpa-stable, and gnu
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
;YASNIPPET
; Important keys and commands:
; - yas-mode
; - TAB (to insert a snippet)
(require 'yasnippet) ;; not yasnippet-bundle
; (setq yas/triggers-in-field 'True)
; (yas/initialize)
; (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")
(setq yas-snippet-dirs
'("~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/text-mode"
))
(yas-global-mode 1)
;end yasnippet section
;UNBOUND
; Important keys and commands:
; - describe-unbound-keys
; - key complexity should be at least 5
(require 'unbound)
;AUTOPAIR
(set-default 'autopair-dont-activate #'(lambda () (eq major-mode 'graphviz-dot-mode)))
(require 'autopair)
(autopair-global-mode)
;GRAPHVIZ
; Requires graphviz installation
; Important keys and commands
; C-c: compile
; C-p: preview
(require 'graphviz-dot-mode)
;(load-file "~/.emacs.d/plugins/graphviz/graphviz-dot-mode.el")
;LINUM
; Importand keys and commands
; - linum-mode
(require 'linum)
(global-linum-mode 1)
;MARKDOWN
; Importand keys and commands
; - C-c C-a l insert hyperlink
; - C-c C-a f insert footnote
; - C-c C-i insert image
; - C-c C-c p preview in browser
(autoload 'markdown-mode "markdown-mode" "Major mode for editing markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
;EXPAND-REGION
; Importand keys and commands
; - C-= expand region
; - M-= contract region
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "M-=") 'er/contract-region)
;IDO MODE
; - C-x C-f C-f open a file without ido-mode enabled in mini-buffer
(require 'ido)
(ido-mode t)
;JEDI AUTO-COMPLETIONS
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
;; ;AUTO-COMPLETIONS
;; ; Importand keys and commands
;; ; - C-i toggle through menu completions
;; (require 'auto-complete)
;; (add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins/auto-complete-1.3.1/dict")
;; (require 'auto-complete-config)
;; (ac-config-default)
;; (global-auto-complete-mode t)
;; ;AUTO-COMPLETION SOURCE ETAGS
;; (require 'auto-complete-etags)
;; (setq-default ac-sources (add-to-list 'ac-sources 'ac-source-etags))
;PYTHON-MODE
; Importand keys and commands
; - C-c ! open python shell
; - C-c | pipe selection to shell
(require 'python-mode)
; use IPython
(setq-default py-shell-name "ipython")
(setq-default py-which-bufname "IPython")
; use the wx backend, for both mayavi and matplotlib
(setq py-python-command-args
'("--gui=wx" "--pylab=wx" "-colors" "Linux"))
(setq py-force-py-shell-name-p t)
; switch to the interpreter after executing code
(setq py-shell-switch-buffers-on-execute-p nil)
(setq py-switch-buffers-on-execute-p nil)
; don't split windows
(setq py-split-windows-on-execute-p nil)
; try to automagically figure out indentation
(setq py-smart-indentation t)
;WINDOW NUMBERING
(require 'window-number)
(window-number-mode)
;FILL COLUMN INDICATOR
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'python-mode-hook 'turn-on-auto-fill)
(setq-default fill-column 79)
(require 'fill-column-indicator)
(setq fci-rule-width 1)
(setq fci-rule-color "#7f9f7f")
(add-hook 'after-change-major-mode-hook 'fci-mode)
;FLYCHECK-GLOBAL-MODE
(add-hook 'after-init-hook 'global-flycheck-mode)
;FLYCHECK keymap prefix conflicts with Python Mode
; change C-c ! to C-c @
(defun change_flycheckprefix()
(define-key flycheck-mode-map flycheck-keymap-prefix nil)
(setq flycheck-keymap-prefix (kbd "C-c @"))
(define-key flycheck-mode-map flycheck-keymap-prefix
flycheck-command-map)
)
(eval-after-load "flycheck"
'(progn
(defun my-flycheck-mode-hook()
(define-key flycheck-mode-map flycheck-keymap-prefix nil)
(setq flycheck-keymap-prefix (kbd "C-c @"))
(define-key flycheck-mode-map flycheck-keymap-prefix
flycheck-command-map)
)
(add-hook 'flycheck-mode-hook 'my-flycheck-mode-hook)
)
)
;; DISABLED MODE CONFIGURATION *******************
;getting rid of autopair in favore of smartparens
;https://github.com/Fuco1/smartparens/wiki
; add modes to sp-ignore-mode-list to turn it off in them specifically
; M-x customize-group
;; (require 'smartparens-config)
;; (smartparens-global-mode t)
;; (show-smartparens-global-mode t)
;HASKELL-MODE
; Important keys and commands:
; This section is disabled
;the following section is for haskell mode
;(load "~/.emacs.d/plugins/haskell-mode-2.8.0/haskell-site-file")
;(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
;(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
;(setq haskell-program-name "C:/Progra~1/Haskel~1/2011.2.0.1/bin/ghci.exe")
;CEDET
;; (load-file "~/.emacs.d/plugins/cedet-1.0/common/cedet.el")
;; (global-ede-mode 1)
;; (semantic-load-enable-code-helpers)
;; (require 'semantic-ia)
;; (require 'semantic-gcc)
;ENVIRONMENT SETTINGS ******************
(require 'color-theme)
(require 'color-theme-zenburn)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-zenburn)))
;disable scroll bars
(scroll-bar-mode -1)
;disable tool bar
(tool-bar-mode -1)
;menu bar available on ctrl-right click
(menu-bar-mode -99)
;TODO look up what this does
(setq x-select-enable-clipboard-manager nil)
;enables replacing of highlighted text
(delete-selection-mode 1)
;;; backups and auto-saves.
;The following pushes backups from the current directory into a backups
; directory
(setq backup-directory-alist '((".*" . "~/.emacs.d/backup"))
backup-by-copying t ; Don't delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess backups
kept-new-versions 20 ; how many of the newest versions to keep
kept-old-versions 5 ; and how many of the old
)
;The following pushes autosaves from the current directory into an
; autosaves directory
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/autosaves/\\1" t)))
;the following line is in place so that when emacs is called
; from the command line with a file
; emacs will open in single-buffer mode
(setq inhibit-startup-screen t)
(add-hook 'emacs-startup-hook 'delete-other-windows)
(setq column-number-mode t)
;; (def parameter th-frame-config-register ?°
;; "The register which is used for storing and restoring frame
;; configurations by `th-save-frame-configuration' and
;; `th-jump-to-register'.")
;; (defun th-save-frame-configuration (arg)
;; "Stores the current frame configuration in register
;; `th-frame-config-register'. If a prefix argument is given, you
;; can choose which register to use."
;; (interactive "P")
;; (let ((register (if arg
;; (read-char "Which register? ")
;; th-frame-config-register)))
;; (frame-configuration-to-register register)
;; (message "Frame configuration saved in register '%c'."
;; register)))
;; (defun th-jump-to-register (arg)
;; "Jumps to register `th-frame-config-register'. If a prefix
;; argument is given, you can choose which register to jump to."
;; (interactive "P")
;; (let ((register (if arg
;; (read-char "Which register? ")
;; th-frame-config-register)))
;; (jump-to-register register)
;; (message "Jumped to register '%c'."
;; register)))
;; (global-set-key (kbd "<F5>")
;; 'th-save-frame-configuration)
;; (global-set-key (kbd "<F6>")
;; 'th-jump-to-register)
(require 'virtualenvwrapper)
(venv-initialize-interactive-shells)
(venv-initialize-eshell)
(setq venv-location "~/venvs/")
;the following section is for pymacs
;(add-to-list 'pymacs-load-path "~/.emacs.d/plugins/Pymacs")
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
;(autoload 'pymacs-autoload "pymacs")
;the following section is for ropemode
;in case rope mode f's up my keybindings
(setq ropemacs-enable-shortcust nil)
(setq ropemacs-local-prefix "C-c C-p")
(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
;end pymacs section
;;; Code:
; this section is for personal functions that aren't big enough to put into
; their own separate plugin file
(defun c-end-line()
(interactive)
(call-interactively 'move-end-of-line)
(unless (looking-back ";")(insert ";"))
(newline-and-indent)
; (move-end-of-line)
)
(add-hook 'c-mode-common-hook
(lambda()
(local-set-key (kbd "M-n") 'c-end-line)))
(defun space-to-work()
(local-set-key (kbd "M-p")(kbd "RET TAB")))
(add-hook 'c-mode-common-hook 'space-to-work)
;;; init.el ends here