-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
221 lines (175 loc) · 7.35 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
(if window-system
(set-frame-size (selected-frame) 200 54))
(load-theme 'maxmink t)
(when (fboundp 'set-fringe-mode) (eval '(set-fringe-mode '(1 . 0))))
(show-paren-mode 1)
(setenv "PATH" (concat (getenv "HOME") "/bin:"
"/usr/local/bin:"
(getenv "PATH")))
(setq exec-path (append exec-path '("/usr/local/bin/")))
(let ((default-directory "~/.emacs.d/vendor/"))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))
(when (> emacs-major-version 23)
(require 'package)
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/")
'APPEND))
;; (setq visible-bell t)
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
(require 'multiple-cursors)
(require 'wrap-region)
(wrap-region-mode t)
(global-set-key "\C-c#" 'comment-or-uncomment-region)
(defadvice comment-or-uncomment-region (before slick-comment activate compile)
"When called interactively with no active region, comment a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(defun touch ()
"updates mtime on the file for the current buffer"
(interactive)
(shell-command (concat "touch " (shell-quote-argument (buffer-file-name))))
(clear-visited-file-modtime))
(global-set-key "\C-xt" 'touch)
;; DASH
(add-to-list 'load-path "dash-at-point")
(autoload 'dash-at-point "dash-at-point"
"Search the word at point with Dash." t nil)
(global-set-key "\C-cd" 'dash-at-point)
;; in modes
(set 'dash-at-point-mode-alist ())
(add-to-list 'dash-at-point-mode-alist '(ruby-mode . "ruby"))
;; SASS-SCSS
(autoload 'scss-mode "scss-mode")
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
(setq scss-compile-at-save nil)
(defun customizations-for-sass-mode ()
(interactive)
(flyspell-prog-mode)
(flymake-sass-load)
(linum-mode t)
(fci-mode)
(auto-complete-mode)
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
)
(add-hook 'sass-mode-hook 'customizations-for-sass-mode)
;; HAML
(require 'haml-mode)
(add-hook 'haml-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(define-key haml-mode-map "\C-m" 'newline-and-indent)))
;; Coffeescript Mode setup
(add-to-list 'load-path "~/.emacs.d/vendor/coffee-mode")
(require 'coffee-mode)
(defun coffee-custom ()
"coffee-mode-hook"
(set (make-local-variable 'tab-width) 2))
(define-key coffee-mode-map [(s-r)] 'coffee-compile-region)
(define-key coffee-mode-map [(s-R)] 'coffee-compile-buffer)
(add-hook 'coffee-mode-hook
'(lambda() (coffee-custom))
)
(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.
'(coffee-command "/usr/local/bin/coffee")
'(coffee-js-mode (quote Javascript))
'(coffee-tab-width 2)
'(css-indent-offset 2)
'(custom-safe-themes
(quote
("27b413061e87e7942c858e351c61915b2c4d88f33f86f5df4cb7e129707f519a" "97d8e9c858500ad5d642691b41e99153677842915b99b6fe39849aee0d47cdd9" "404daa8fce5ddf652e607f55c3fac52b04bc058211e463668d780a4e39c9282a" "47674274ab98da21f4b955a0246fb97bd6abfab9a0bf478373ab67580ceee568" "17927a37ac39f1111b24c392d8f6796610226a2fa90c399819072f654631d8e2" "56c2a22f1ffa3ff79b6d21867e6e3889ba29ffa9a74b4b39ee95bb7e2050a7f5" "e42898fa676fe8dcd5d93f9b02ae2e3fd167137b9c7ed99cd0442febafb1ba4d" "9bb90f5aa884f41c469dfe3c97f8214095b78b18ad89c139698aa88e35ab3a47" "d4dccc5d66eaa8bd06dff1f29b41220cb2db8344f948eacce90d96cdbb0c22d8" default)))
'(display-time-mode nil)
'(frame-background-mode nil)
'(global-linum-mode t)
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(js-indent-level 2)
'(ns-tool-bar-display-mode (quote both) t)
'(ns-tool-bar-size-mode (quote regular) t)
'(size-indication-mode t)
'(tool-bar-mode nil)
'(uniquify-buffer-name-style (quote forward) nil (uniquify))
'(visual-line-mode nil t))
(setq whitespace-action '(auto-cleanup)) ;; automatically clean up bad whitespace
(setq whitespace-style '(trailing space-before-tab indentation empty space-after-tab)) ;; only show bad whitespace
(global-whitespace-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; START: Ruby / Rails setup
;; Interactively Do Things (highly recommended, but not strictly required)
(require 'ido)
(ido-mode t)
;; Assign .rb, .rake and GEMFILE files to use ruby mode
(setq auto-mode-alist (cons '("\\.rb\\'" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rake\\'" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\GEMFILE\\'" . ruby-mode) auto-mode-alist))
;; Show syntax highlighting when in ruby mode
(add-hook 'ruby-mode-hook '(lambda () (font-lock-mode 1)))
;; END: Ruby / Rails setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(add-to-list 'load-path "/path/to/ack-and-a-half")
(require 'ack-and-a-half)
(defalias 'ack 'ack-and-a-half)
(defalias 'ack-same 'ack-and-a-half-same)
(defalias 'ack-find-file 'ack-and-a-half-find-file)
(defalias 'ack-find-file-same 'ack-and-a-half-find-file-same)
(require 'handlebars-mode)
;; (require 'autopair)
;; (autopair-global-mode) ;; to enable in all buffers
(electric-pair-mode)
(require 'textmate)
(textmate-mode)
;; (require 'icicles)
(require 'whole-line-or-region)
(whole-line-or-region-mode) ;; to enable in all buffers
(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.
'(default ((t (:inherit nil :stipple nil :background "#f8efd3" :foreground "#2e3436" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 140 :width normal :foundry "nil" :family "Anonymous Pro")))))
(put 'upcase-region 'disabled nil)
(add-hook
'align-load-hook
(lambda ()
(add-to-list
'align-rules-list
'(symbol-value-alignment
(regexp . ":\\(\\s-*\\)")
(group . 1)
(modes . '(ruby-mode coffee-mode))
(repeat . nil)))))
(global-set-key (kbd "s-=") 'zoom-frm-in)
(global-set-key (kbd "s--") 'zoom-frm-out)
(global-set-key (kbd "s-0") 'zoom-frm-unzoom)
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(add-to-list 'ac-modes 'coffee-mode)
(add-to-list 'ac-modes 'scss-mode)
(add-to-list 'ac-modes 'handlebars-mode)
(global-auto-complete-mode)
(put 'downcase-region 'disabled nil)
(require 'uniquify)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "C-M-s") 'isearch-forward)
(global-set-key (kbd "C-M-r") 'isearch-backward)
(setq default-directory (concat (getenv "HOME") "/"))
(add-to-list 'load-path "/path/to/dash-at-point")
(autoload 'dash-at-point "dash-at-point"
"Search the word at point with Dash." t nil)
(global-set-key "\C-cd" 'dash-at-point)