-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemacs
199 lines (159 loc) · 7.12 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
(add-to-list 'load-path "~/.emacs.d/lisp")
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
(setq-default show-trailing-whitespace 't)
(show-paren-mode 1)
(setq vc-follow-symlinks nil)
(setq read-file-name-completion-ignore-case nil)
;(setq completions-format 'vertical)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;; frame-size and pos
(when window-system
(when (> (x-display-pixel-height) 1800)
(set-frame-position (selected-frame) -320 -1200)
(set-frame-size (selected-frame) 140 73)))
;; pyflakes
(add-to-list 'load-path "~/.emacs.d/vendor")
;; rainbow parens
(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.
'(rainbow-delimiters-depth-1-face ((t (:foreground "orange"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "pink"))))
'(rainbow-delimiters-depth-3-face ((t (:foreground "chartreuse"))))
'(rainbow-delimiters-depth-4-face ((t (:foreground "sky blue"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "yellow"))))
'(rainbow-delimiters-depth-6-face ((t (:foreground "orchid"))))
'(rainbow-delimiters-depth-7-face ((t (:foreground "green"))))
'(rainbow-delimiters-depth-8-face ((t (:foreground "sienna1")))))
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
;; (add-hook 'find-file-hook 'flymake-find-file-hook)
;; flymake-find-file-hook seems to append new-lines to python files on save
;; (when (load "flymake" t)
;; (defun flymake-pyflakes-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 "pycheckers" (list local-file))))
;; (add-to-list 'flymake-allowed-file-name-masks
;; '("\\.py\\'" flymake-pyflakes-init)))
;; (load-library "flymake-cursor")
;; (defun flymake-display-warning (warning)
;; (message warning))
;; (global-set-key (kbd "C-c .") `flymake-mode)
;; TAGS
;; (defun find-file-upwards (file-to-find)
;; "Recursively searches each parent directory starting from the default-directory.
;; looking for a file with name file-to-find. Returns the path to it
;; or nil if not found."
;; (labels
;; ((find-file-r (path)
;; (let* ((parent (file-name-directory path))
;; (possible-file (concat parent file-to-find)))
;; (cond
;; ((file-exists-p possible-file) possible-file) ; Found
;; ;; The parent of ~ is nil and the parent of / is itself.
;; ;; Thus the terminating condition for not finding the file
;; ;; accounts for both.
;; ((or (null parent) (equal parent (directory-file-name parent))) nil) ; Not found
;; (t (find-file-r (directory-file-name parent))))))) ; Continue
;; (find-file-r default-directory)))
;; (let ((my-tags-file (find-file-upwards "TAGS")))
;; (when my-tags-file
;; (message "Loading tags file: %s" my-tags-file)
;; (visit-tags-table my-tags-file)))
;; (setq tags-revert-without-query t)
;; (defun create-tags (dir-name)
;; "Create tags file."
;; (shell-command
;; "find -f ~/src/superfly/TAGS ~/src/superfly/ -name '*.py' | xargs etags")
;; )
;; ropemacs
;; (require 'pymacs)
;; (pymacs-load "ropemacs" "rope-")
;; (setq ropemacs-enable-autoimport t)
;; auto complete
;; (add-to-list 'load-path "~/.emacs.d/vendor/auto-complete-1.2")
;; (require 'auto-complete-config)
;; (add-to-list 'ac-dictionary-directories "~/.emacs.d/vendor/auto-complete-1.2/dict")
;; (ac-config-default)
;; Smooth Scrolling
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(setq frame-title-format
(list (format "%s %%S: %%j " (system-name))
'(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
(column-number-mode 1)
(setq-default c-basic-offset 4)
(require 'column-marker)
(add-hook 'after-change-major-mode-hook
(lambda ()
(interactive)
(column-marker-1 79)))
(add-hook 'ruby-mode-hook #'rubocop-mode)
(add-hook 'ruby-mode-hook 'robe-mode)
(setq ruby-align-chained-calls 't)
;; (global-set-key [C-tab] 'next-buffer)
;; (global-set-key [C-S-tab] 'previous-buffer)
(defun backward-delete-word (arg)
"Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-region (point) (progn (backward-word arg) (point))))
(define-key minibuffer-local-map [M-backspace] 'backward-delete-word)
(define-key minibuffer-local-map [C-backspace] 'backward-delete-word)
(when (display-graphic-p)
(invert-face 'default))
;(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
;(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
;(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
;(setq lua-indent-level 4)
(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.
'(inhibit-startup-screen t)
'(js-indent-level 2)
'(tool-bar-mode nil))
(kill-buffer "*scratch*")
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(add-to-list 'load-path "~/.emacs.d/el-get")
;; Fuzzy search
(global-set-key (kbd "C-x v") 'fiplr-find-file)
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(goto-char (point-max))
(eval-print-last-sexp)))
(load-file "~/.emacs.d/el-get/web-mode/web-mode.elc")
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
(setq web-mode-code-indent-offset 2)
(setq web-mode-markup-indent-offset 2)
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
(add-hook 'csv-mode-hook (lambda () (csv-align-fields nil (point-min) (point-max))))