-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold_work_emacs
284 lines (218 loc) · 8.17 KB
/
old_work_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
;; melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
;; common
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)
(setq x-select-enable-clipboard t) ;; Enable copy/past-ing from clipboard
;;(prefer-coding-system ‘utf-8) ;; Prefer UTF-8 encoding
;;(fset 'yes-or-no-p ‘y-or-n-p) ;; Answer with y and n instead of yes and no
;;(setq confirm-kill-emacs ‘yes-or-no-p) ;; Ask for confirmation before closing emacs
(global-auto-revert-mode 1) ;; Always reload the file if it changed on disk
(show-paren-mode 1) ;; Highlight matching parens
(global-subword-mode 1) ;; correctly jump between words in CamelCase
(global-visual-line-mode 1)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
;; org-mode
(setq org-src-fontify-natively t)
(setq org-agenda-files '("~/gtd"))
(setq org-default-notes-file "~/.notes")
;; tramp
(require 'tramp)
(eval-after-load 'tramp '(setenv "SHELL" "/bin/bash"))
(setq tramp-debug-buffer t)
(setq tramp-verbose 6)
;; opacity
(set-frame-parameter (selected-frame) 'alpha '(90 . 80))
(add-to-list 'default-frame-alist '(alpha . (90 . 80)))
;; line number frame
(global-linum-mode t)
;; (require 'misc)
;; (global-set-key (kbd "M-f") 'forward-to-word)
;; macro to revert buffer
(fset 'alec-revert-buffer
[?\M-x ?r ?e ?v ?e ?r ?t ?- ?b ?u ?f ?f ?e ?r return ?y ?e ?s return])
(global-set-key [f6] 'alec-revert-buffer)
;; rbenv
(global-rbenv-mode)
(rbenv-use-global)
;; omnisharp
(eval-after-load
'company
'(add-to-list 'company-backends 'company-omnisharp))
(defun my-csharp-mode-setup ()
(omnisharp-mode)
(company-mode)
(flycheck-mode)
(setq indent-tabs-mode nil)
(setq c-syntactic-indentation t)
(c-set-style "ellemtel")
(setq c-basic-offset 4)
(setq truncate-lines t)
(setq tab-width 4)
(setq evil-shift-width 4)
;csharp-mode README.md recommends this too
;(electric-pair-mode 1) ;; Emacs 24
;(electric-pair-local-mode 1) ;; Emacs 25
(local-set-key (kbd "C-c r r") 'omnisharp-run-code-action-refactoring)
(local-set-key (kbd "C-c C-c") 'recompile))
(add-hook 'csharp-mode-hook 'my-csharp-mode-setup t)
;; projectile
(projectile-global-mode)
(projectile-rails-global-mode)
(projectile-mode +1)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-completion-system 'ivy)
(setq projectile-switch-project-action 'projectile-commander)
(setq projectile-rails-vanilla-command "bin/rails")
(setq projectile-rails-spring-command "bin/rails")
(require 'projectile)
(def-projectile-commander-method ?s
"Open a *shell* buffer for the project."
(projectile-run-shell))
(def-projectile-commander-method ?d
"Open project root in dired."
(projectile-dired))
(require 'inf-ruby)
(add-hook 'after-init-hook 'inf-ruby-switch-setup) ;; hit C-x C-q when breakpoint is hit
;; ivy
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key "\C-s" 'swiper)
;; ido
(require 'ido)
(ido-mode t)
(setq ido-separator "\n")
(setq ido-use-filename-at-point 'guess)
(global-set-key (kbd "M-i") 'imenu)
;; ;; Flycheck
;; ;; (require 'flycheck)
;; ;; Company
(add-hook 'after-init-hook 'global-company-mode)
(with-eval-after-load 'company
(add-to-list 'company-backends 'company-tern)
(global-set-key (kbd "M-SPC") 'company-complete)
)
(setq company-idle-delay 0)
;; ;; tide
;; (require 'tide)
;; (defun setup-tide-mode ()
;; (interactive)
;; (tide-setup)
;; (flycheck-mode +1)
;; (setq flycheck-check-syntax-automatically '(save mode-enabled))
;; (eldoc-mode +1)
;; (tide-hl-identifier-mode +1)
;; ;; company is an optional dependency. You have to
;; ;; install it separately via package-install
;; (company-mode +1))
;; Web mode
(use-package web-mode
:init (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)))
;; :ensure t
;; :defer t
;; :mode (("\\.ios\\.js$" . web-mode)
;; :mode (("\\.ios\\.js$" . web-mode)
;; ;; ("\\.android\\.js$" . web-mode)
;; ;; ("\\.react\\.js$" . web-mode)
;; ;; ("\\.js$" . web-mode))
;; ;; :config
;; (require 'web-mode)
;; (setq web-mode-content-types-alist
;; '(("jsx" . ".*\\.js[x]?\\'")))
;; (add-to-list 'magic-mode-alist '("^import React" . web-mode))
;; (add-to-list 'magic-mode-alist '("React.Component" . web-mode))
;; (add-to-list 'magic-mode-alist '("from 'react';$" . web-mode))
;; (add-to-list 'web-mode-indentation-params '("lineup-calls" . nil))
;; (add-to-list 'auto-mode-alist '("\\.scss?\\'" . web-mode))
;; (with-eval-after-load 'flycheck
;; (flycheck-add-mode 'javascript-eslint 'web-mode))
;; (add-hook 'web-mode-hook
;; (lambda ()
;; (If (equal web-mode-content-type "javascript")
;; (web-mode-set-content-type "jsx"))))
;; (setq-local web-mode-enable-auto-quoting nil)
;; (setq-default js-indent-level 4)
;; (add-hook 'web-mode-hook
;; (lambda ()
;; (setq web-mode-markup-indent-offset (symbol-value 'js-indent-level))
;; (setq web-mode-attr-indent-offset (symbol-value 'js-indent-level))
;; (setq web-mode-css-indent-offset (symbol-value 'js-indent-level))
;; (setq web-mode-code-indent-offset (symbol-value 'js-indent-level))
;; )
;; )
;; ;; (require 'web-mode)
;; ;; (setq web-mode-content-types-alist
;; ;; '(("jsx" . ".*\\.js[x]?\\'")))
;; ;; (add-to-list 'auto-mode-alist '("\\.jsx'" . web-mode))
;; ;; (add-to-list 'auto-mode-alist '("\\.tsx'" . web-mode))
;; ;; (add-to-list 'auto-mode-alist '(".*\\.js\\'" . web-mode))
;; ;; ;; Flycheck
;; (require 'flycheck)
;; ;; disable jshint since we prefer eslint checking
;; (setq-default flycheck-disabled-checkers
;; (append flycheck-disabled-checkers
;; '(javascript-jshint)))
;; ;; use eslint with web-mode for jsx files
;; (flycheck-add-mode 'javascript-eslint 'web-mode)
;; (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
;; ;; (flycheck-add-mode 'javascript-eslint 'javascript-mode)
;; ;; ;; rjsx-mode
;; ;; ;; strict mode off
;; ;; (setq js2-strict-missing-semi-warning nil)
;; ;; (add-hook 'rjsx-mode-hook #'setup-tide-mode)
;; ;; ;; don't auto close new tags
;; ;; ;; (eval-after-load 'rjsx-mode
;; ;; ;; '(progn
;; ;; ;; (define-key rjsx-mode-map "<" nil)))
;; ;; (add-hook 'rjsx-mode-hook
;; ;; (lambda ()
;; ;; (when (string-equal "jsx" (file-name-extension buffer-file-name))
;; ;; (setup-tide-mode))))
;; ;; ;; configure jsx-tide checker to run after your default jsx checker
;; ;; (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
;; ;; Python debugger
(fset 'pdb
"import pdb; pdb.set_trace()")
(global-set-key (kbd "C-x , p") 'pdb )
;; ;; This has something to do with screen splitting ie. C-x 2 etc
;; ;; (setq split-height-threshold nil)
;; ;; (setq split-width-threshold 0)
;; ;; IDO
;; (require 'ido)
;; (ido-mode t)
;; ;; Helm and Projectile
;; (require 'helm)
;; (global-set-key (kbd "M-x") #'helm-M-x)
;; (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
;; (global-set-key (kbd "C-x C-f") #'helm-find-files)
;; (helm-mode 1)
;; (require 'helm-config)
;; (require 'helm-projectile)
;; (projectile-global-mode)
;; (setq projectile-completion-system 'helm)
;; (helm-projectile-on)
(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.
'(custom-enabled-themes (quote (calmer-forest)))
'(custom-safe-themes
(quote
("8dc7f4a05c53572d03f161d82158728618fb306636ddeec4cce204578432a06d" default)))
'(org-agenda-files (quote ("~/gtd/id-unionswiss.org")) t)
'(package-selected-packages
(quote
(counsel swiper org yasnippet-snippets yasnippet omnisharp bundler git-timemachine git-time-metric magit web-mode ivy ag projectile-rails projectile company calmer-forest-theme))))
(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.
)
(set-face-attribute 'default (selected-frame) :height 100)