-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
208 lines (175 loc) · 7.01 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
;; marmalade - http://marmalade-repo.org/
;; melpa - http://melpa.milkbox.net/
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; (load-file "~/projects/espotify/demo.el")
;; use solarized theme
(load-theme 'solarized-dark t)
;; save sessions
(desktop-save-mode 1)
;; from https://github.com/purcell/emacs.d/blob/master/lisp/init-sessions.el
(setq desktop-globals-to-save
(append '(desktop-missing-file-warning
(dired-regexp-history . 20)
(extended-command-history . 30)
(face-name-history . 20)
(file-name-history . 100)
(grep-find-history . 30)
(grep-history . 30)
(ido-buffer-history . 100)
(ido-last-directory-list . 100)
(ido-work-directory-list . 100)
(ido-work-file-list . 100)
(magit-read-rev-history . 50)
(minibuffer-history . 50)
(org-clock-history . 50)
(org-refile-history . 50)
(org-tags-history . 50)
(query-replace-history . 60)
(read-expression-history . 60)
(regexp-history . 60)
(regexp-search-ring . 20)
register-alist
(search-ring . 20)
(shell-command-history . 50)
tags-file-name
tags-table-list)))
;; turn off toolbar
(tool-bar-mode -1)
;; turn off scrollbars
(scroll-bar-mode -1)
;; don't blink the cursor (by keeping this commented)
;;(blink-cursor-mode t)
;; visual bell > OS X's funk sound
(setq visible-bell t)
;; don't rm files
(setq delete-by-moving-to-trash t)
;; turn on ido-mode by default
(ido-mode t)
;; winner mode enable
;; this is a global minor mode for undo/redo on window adjustments
(winner-mode 1)
(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.
'(android-mode-sdk-dir "~/android-sdk")
'(background-color "#042028")
'(background-mode dark)
'(backup-by-copying t)
'(backup-directory-alist (quote (("." . "~/.saves"))))
'(bmkp-last-as-first-bookmark-file "~/.emacs.d/bookmarks")
'(c-default-style
(quote
((c-mode . "k&r")
(c++-mode . "k&r")
(java-mode . "java")
(awk-mode . "awk")
(other . "gnu"))))
'(coffee-tab-width 2)
'(column-number-mode t)
'(confirm-kill-emacs (quote yes-or-no-p))
'(cursor-color "#708183")
'(custom-safe-themes
(quote
("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" default)))
'(foreground-color "#708183")
'(gofmt-command "goimports")
'(ido-create-new-buffer (quote always))
'(ido-enable-flex-matching t)
'(ido-everywhere t)
'(indent-tabs-mode nil)
'(magit-diff-use-overlays nil)
'(magit-git-executable "/usr/local/bin/git")
'(magit-use-overlays nil)
'(package-selected-packages
(quote
(ace-jump-mode restclient go-mode typescript-mode jinja2-mode markdown-mode ox-gfm ag docker dockerfile-mode salt-mode switch-window magit paredit solarized-theme color-theme)))
'(tab-width 2)
'(tramp-default-method "ssh"))
(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.
)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c SPC") 'ace-jump-mode)
(global-set-key (kbd "C-w") 'backward-kill-word)
(global-set-key (kbd "C-x C-k") 'kill-region) ;; remap since C-w was formerly kill-region
(global-set-key (kbd "M-SPC") 'cycle-spacing)
(global-set-key (kbd "C-c p s") 'espotify)
(global-set-key (kbd "C-c p p") 'espotify-playpause)
(global-set-key (kbd "C-c p t") 'espotify-current-track)
(global-set-key (kbd "C-c p f") 'espotify-next-track)
(global-set-key (kbd "C-c p b") 'espotify-previous-track)
;; use ibuffer instead of list-buffers
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; use switch-window instead of other-window
(global-set-key (kbd "C-x o") 'switch-window)
(defun coffee-doc ()
(interactive)
(setq-local helm-dash-docsets '("CoffeeScript" "Lo-Dash")))
(add-hook 'coffee-mode-hook 'coffee-doc)
(add-hook 'go-mode-hook
`(lambda () (add-hook 'before-save-hook 'gofmt-before-save)))
(put 'dired-find-alternate-file 'disabled nil)
(add-to-list 'auto-mode-alist '("\\.mdown\\'" . markdown-mode))
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-hook 'emacs-lisp-mode-hook
(lambda ()
;; use spaces, not tabs
(setq indent-tabs-mode nil)))
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-strucutural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('
(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
(setq common-lisp-hyperspec-root "file:/Users/rbarry/.emacs.d/hyperspec/HyperSpec/")
;; tramp stuff
(set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:"))))
(require 'tramp)
(defun sudo-edit-current-file ()
(interactive)
(let ((position (point)))
(find-alternate-file
(if (file-remote-p (buffer-file-name))
(let ((vec (tramp-dissect-file-name (buffer-file-name))))
(tramp-make-tramp-file-name
"sudo"
(tramp-file-name-user vec)
(tramp-file-name-host vec)
(tramp-file-name-localname vec)))
(concat "/sudo:root@localhost:" (buffer-file-name))))
(goto-char position)))
;; some helpers
(defun func-region (start end func)
"run a function over the region between START and END in current buffer."
(save-excursion
(let ((text (delete-and-extract-region start end)))
(insert (funcall func text)))))
(defun hex-region (start end)
"urlencode the region between START and END in current buffer."
(interactive "r")
(func-region start end #'url-hexify-string))
(defun unhex-region (start end)
"de-urlencode the region between START and END in current buffer."
(interactive "r")
(func-region start end #'url-unhex-string))
(require 'ansi-color)
(defun display-ansi-colors ()
(interactive)
(ansi-color-apply-on-region (point-min) (point-max)))