forked from vmihailenco/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
205 lines (151 loc) · 6.51 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
(require 'package)
(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
starter-kit-js
starter-kit-bindings
starter-kit-eshell
zenburn-theme
go-mode
coffee-mode
flymake-coffee
sass-mode
scss-mode
less-css-mode
full-ack
expand-region
autopair
)
"A list of packages to ensure are installed at launch.")
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
;-------------------------------------------------------------------------------
(setq tab-width 4)
(setq default-tab-width 4)
(setq auto-save-default nil)
(set-default-font "Consolas-11")
(setq initial-major-mode 'text-mode)
(setq initial-scratch-message nil)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq-default whitespace-style '(face trailing lines empty indentation::space))
(setq-default whitespace-line-column 80)
(global-whitespace-mode t)
;; disable auto wrapping
(add-hook 'html-mode-hook '(lambda () (auto-fill-mode 0)))
(remove-hook 'text-mode-hook 'turn-on-auto-fill)
;-------------------------------------------------------------------------------
;; automatically save buffers associated with files on buffer switch
;; and on windows switch
(defadvice switch-to-buffer (before save-buffer-now activate)
(when buffer-file-name (save-buffer)))
(defadvice other-window (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-up (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-down (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-left (before other-window-now activate)
(when buffer-file-name (save-buffer)))
(defadvice windmove-right (before other-window-now activate)
(when buffer-file-name (save-buffer)))
;;------------------------------------------------------------------------------
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
;;------------------------------------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/vendor/projutils.el.d")
(require 'projutils)
(projutils-global-mode 1)
(setq projutils-grep-use-ack nil)
(setq-default projutils-ffip-allowed-file-extensions
'("txt" "py" "html" "js" "css" "coffee" "sass" "scss" "less" "go"))
;;------------------------------------------------------------------------------
(require 'autopair)
(autopair-global-mode)
;;------------------------------------------------------------------------------
(require 'go-mode)
(setq gofmt-command "goimports")
(add-hook 'before-save-hook 'gofmt-before-save)
(add-to-list 'load-path "~/workspace/gocode/src/github.com/dougm/goflymake")
(require 'go-flymake)
;;------------------------------------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/vendor/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")
;;------------------------------------------------------------------------------
;; (require 'pymacs)
;; (pymacs-load "ropemacs" "rope-")
;;------------------------------------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/vendor/python.el.d")
(require 'python)
(add-hook 'python-mode-hook
(lambda ()
(setq imenu-create-index-function 'python-imenu-create-index)))
(add-hook 'python-mode-hook 'esk-local-column-number-mode)
(add-hook 'python-mode-hook 'esk-local-comment-auto-fill)
(add-hook 'python-mode-hook 'esk-turn-on-hl-line-mode)
(add-hook 'python-mode-hook 'esk-turn-on-save-place-mode)
(add-hook 'python-mode-hook 'esk-pretty-lambdas)
(add-hook 'python-mode-hook 'esk-add-watchwords)
(add-hook 'python-mode-hook 'esk-turn-on-idle-highlight-mode)
;;------------------------------------------------------------------------------
; Flymake is implemented as an Emacs minor mode. It runs the syntax check tool
; (the compiler for C++ files, perl for perl files, etc.) in the background,
; passing it a temporary copy of the current buffer and parses the output for
; known error/warning message patterns. Flymake then highlights erroneous lines
; (that is, lines for which at least one error or warning has been reported),
; and displays an overall buffer status in the mode line, as shown on the figure
; below.
(when (load "flymake" t)
(defun flymake-pycheckers-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "~/.emacs.d/bin/checkers" (list "--checkers=pep8,pyflakes" local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pycheckers-init)))
(add-hook 'python-mode-hook
(lambda ()
(unless (eq buffer-file-name nil) (flymake-mode 1))
(local-set-key [f2] 'flymake-goto-prev-error)
(local-set-key [f3] 'flymake-goto-next-error)))
;;----------------------------------------------------------------------------=
(add-hook 'js-mode-hook 'flymake-jslint-load)
;;----------------------------------------------------------------------------=
(require 'haml-mode)
(require 'sass-mode)
;;------------------------------------------------------------------------------
(setq scss-compile-at-save nil)
(autoload 'scss-mode "scss-mode")
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
(add-hook 'scss-mode
(set (make-local-variable 'tab-width) 2))
;;------------------------------------------------------------------------------
(require 'coffee-mode)
; set tab-width = 2 special for coffeescript
(defun coffee-custom ()
"coffee-mode-hook"
(set (make-local-variable 'tab-width) 2))
(add-hook 'coffee-mode-hook
'(lambda() (coffee-custom)))
;;------------------------------------------------------------------------------
(load-theme 'zenburn t)
;;------------------------------------------------------------------------------
;; http://nschum.de/src/emacs/full-ack/
(autoload 'ack-same "full-ack" nil t)
(autoload 'ack "full-ack" nil t)
(autoload 'ack-find-same-file "full-ack" nil t)
(autoload 'ack-find-file "full-ack" nil t)