-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
326 lines (271 loc) · 9.39 KB
/
.emacs
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
;; No splash screen please ... jeez
(setq inhibit-startup-message t)
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
(tooltip-mode -1)
(mouse-wheel-mode t)
(blink-cursor-mode -1))
(add-hook 'before-make-frame-hook 'turn-off-tool-bar)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(ansi-color-for-comint-mode-on)
(setq visible-bell t
fringe-mode (cons 4 0)
echo-keystrokes 0.1
font-lock-maximum-decoration t
inhibit-startup-message t
transient-mark-mode t
color-theme-is-global t
shift-select-mode nil
mouse-yank-at-point t
require-final-newline t
truncate-partial-width-windows nil
uniquify-buffer-name-style 'forward
ffap-machine-p-known 'reject
whitespace-style '(trailing lines space-before-tab
face indentation space-after-tab)
whitespace-line-column 100
ediff-window-setup-function 'ediff-setup-windows-plain
xterm-mouse-mode t)
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-refresh-contents)
(package-initialize)
(defvar my-packages '(evil evil-leader evil-numbers solarized-theme
geiser magit paredit rainbow-delimiters slime slime-repl slime-fuzzy
anything anything-config anything-match-plugin
pretty-lambdada pretty-mode-plus)
"A list of packages to ensure are installed at launch." )
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(require 'evil)
(evil-mode 1)
(require 'evil-leader)
(evil-leader/set-leader (kbd ";"))
;(require 'surround)
;(global-surround-mode 1)
(load-theme 'solarized-dark t)
;(load "elscreen" "ElScreen"
;(define-key evil-normal-state-map (kbd "C-w t") 'elscreen-create) ;create tab
;(define-key evil-normal-state-map (kbd "C-w x") 'elscreen-kill) ;kill
;(define-key evil-normal-state-map "gT" 'elscreen-previous) ;previous tab
;(define-key evil-normal-state-map "gt" 'elscreen-next) ;next tab
(menu-bar-mode t)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq-default mode-line-format t)
;Toggle line numbers
(global-linum-mode t)
;(left-fringe . 0); no fringe
;(right-fringe . 0)
;(border-width . 0)
;Disable useleess annoyng beeps on scroll
(setq ring-bell-function 'ignore)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(add-to-list 'default-frame-alist '(height . 50))
(add-to-list 'default-frame-alist '(width . 150))
(setq geiser-racket-binary "/usr/local/bin/racket")
;; Mode line setup
(setq-default
mode-line-format
'(; Position, including warning for 80 columns
(:propertize "%4l:" face mode-line-position-face)
(:eval (propertize "%3c" 'face
(if (>= (current-column) 80)
'mode-line-80col-face
'mode-line-position-face)))
; emacsclient [default -- keep?]
mode-line-client
" "
; read-only or modified status
(:eval
(cond (buffer-read-only
(propertize " RO " 'face 'mode-line-read-only-face))
((buffer-modified-p)
(propertize " ** " 'face 'mode-line-modified-face))
(t " ")))
" "
; directory and buffer/file name
(:propertize (:eval (shorten-directory default-directory 30))
face mode-line-folder-face)
(:propertize "%b"
face mode-line-filename-face)
; narrow [default -- keep?]
" %n "
; mode indicators: vc, recursive edit, major mode, minor modes, process, global
(vc-mode vc-mode)
" %["
(:propertize mode-name
face mode-line-mode-face)
"%] "
(:eval (propertize (format-mode-line minor-mode-alist)
'face 'mode-line-minor-mode-face))
(:propertize mode-line-process
face mode-line-process-face)
(global-mode-string global-mode-string)
" "
; nyan-mode uses nyan cat as an alternative to %p
;(:eval (when nyan-mode (list (nyan-create))))
))
;; Helper function
(defun shorten-directory (dir max-length)
"Show up to `max-length' characters of a directory name `dir'."
(let ((path (reverse (split-string (abbreviate-file-name dir) "/")))
(output ""))
(when (and path (equal "" (car path)))
(setq path (cdr path)))
(while (and path (< (length output) (- max-length 4)))
(setq output (concat (car path) "/" output))
(setq path (cdr path)))
(when path
(setq output (concat ".../" output)))
output))
;; Extra mode line faces
(make-face 'mode-line-read-only-face)
(make-face 'mode-line-modified-face)
(make-face 'mode-line-folder-face)
(make-face 'mode-line-filename-face)
(make-face 'mode-line-position-face)
(make-face 'mode-line-mode-face)
(make-face 'mode-line-minor-mode-face)
(make-face 'mode-line-process-face)
(make-face 'mode-line-80col-face)
(set-face-attribute 'mode-line nil
:foreground "gray60"
:inverse-video nil
:box '(:line-width 1 :color "gray20" :style nil))
(set-face-attribute 'mode-line-inactive nil
:foreground "gray80"
:inverse-video nil
:box '(:line-width 1 :color "gray10" :style nil))
(set-face-attribute 'mode-line-read-only-face nil
:inherit 'mode-line-face
; :foreground "#4271ae"
:box '(:line-width 2 :color "#4271ae"))
(set-face-attribute 'mode-line-modified-face nil
:inherit 'mode-line-face
; :foreground "#c82829"
; :background "#ffffff"
:box '(:line-width 2 :color "#c82829"))
(set-face-attribute 'mode-line-folder-face nil
:inherit 'mode-line-face
:foreground "gray60")
(set-face-attribute 'mode-line-filename-face nil
:inherit 'mode-line-face
:foreground "#eab700"
:weight 'bold)
(set-face-attribute 'mode-line-position-face nil
:inherit 'mode-line-face
:family "Menlo" :height 100)
(set-face-attribute 'mode-line-mode-face nil
:inherit 'mode-line-face
:foreground "gray80")
(set-face-attribute 'mode-line-minor-mode-face nil
:inherit 'mode-line-mode-face
:foreground "gray40"
:height 110)
(set-face-attribute 'mode-line-process-face nil
:inherit 'mode-line-face
:foreground "#718c00")
(set-face-attribute 'mode-line-80col-face nil
:inherit 'mode-line-position-face
:foreground "black" :background "#eab700")
;; Some stuff for moving lines around, and starting newline
(defun move-line-down ()
(interactive)
(let ((col (current-column)))
(save-excursion
(forward-line)
(transpose-lines 1))
(forward-line)
(move-to-column col)))
(defun move-line-up ()
(interactive)
(let ((col (current-column)))
(save-excursion
(forward-line)
(transpose-lines -1))
(move-to-column col)))
(global-set-key (kbd "<C-S-down>") 'move-line-down)
(global-set-key (kbd "<C-S-up>") 'move-line-up)
(defun open-line-below ()
(interactive)
(end-of-line)
(newline)
(indent-for-tab-command))
(defun open-line-above ()
(interactive)
(beginning-of-line)
(newline)
(forward-line -1)
(indent-for-tab-command))
(global-set-key (kbd "<C-return>") 'open-line-below)
(global-set-key (kbd "<C-S-return>") 'open-line-above)
;; Auto refresh buffers
(global-auto-revert-mode 1)
;; Also auto refresh dired, but be quiet about it
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)
;; Save point position between sessions
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
;; Write backup files to own directory
(setq backup-directory-alist
`(("." . ,(expand-file-name
(concat user-emacs-directory "backups")))))
;; Make backups of files, even when they're in version control
(setq vc-make-backup-files t)
; Globally enable rainbow delimeters
(global-rainbow-delimiters-mode)
; SLIME setup
;(setq inferior-lisp-program "/usr/local/bin/ccl64")
;(require 'slime-autoloads)
;(eval-after-load 'slime '(setq slime-protocol-version 'ignore))
;(slime-setup '(slime-repl))
(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.
'(geiser-mode-company-p nil)
'(geiser-mode-smart-tab-p 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.
)
;; Use Shift-arrows for split navigation
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
;; Use pretty lambda
(require 'pretty-lambdada)
(pretty-lambda-for-modes)
;; Always go after symlinked files
(setq vc-follow-symlinks t)
;; Enable IDO everyhere
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(setq ido-ubiquitous t)
(ido-mode 1)
(setq ido-create-new-buffer 'always)
;; Try
(setq ido-use-filename-at-point 'guess)
; Vim-like key bindings
; <Leader>b show buffers
(evil-leader/set-key "b" 'ibuffer)
; Leader lb - ido buffers lf - ido files
(evil-leader/set-key "lb" 'ido-switch-buffer)
(evil-leader/set-key "lf" 'ido-find-file)
;; Transparently open compressed files
(auto-compression-mode t)
;; Enable syntax highlighting for older Emacsen that have it off
(global-font-lock-mode t)
;; Save a list of recent files visited.
(recentf-mode 1)
;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)