forked from ohmyzsh/ohmyzsh
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.emacs
186 lines (156 loc) · 6.56 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
; list the packages you want
(setq package-list '(auctex expand-region gist magit magithub markdown-mode paredit projectile
python sass-mode rainbow-mode scss-mode solarized-theme anything
volatile-highlights evil evil-leader scala-mode2 sbt-mode flx-ido
js2-refactor tern tern-auto-complete yasnippet auto-complete
helm helm-ls-git dtrt-indent highlight-chars))
; list the repositories containing them
(setq package-archives '(("elpa" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
; activate all the packages (in particular autoloads)
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
; Solarized Theme
(load-theme 'solarized-dark)
; Detect Indentation
(require 'dtrt-indent)
(dtrt-indent-mode t)
;; Use spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; ;; Set tab to display as 4 spaces
(setq-default tab-width 4)
;; ;; Set stop-tabs to be 4 written as spaces
(setq-default tab-stop-list (number-sequence 4 120 4))
;; highlight tabs and trailing whitespace
(require 'highlight-chars)
(add-hook 'font-lock-mode-hook 'hc-highlight-tabs)
;(add-hook 'font-lock-mode-hook 'hc-highlight-trailing-whitespace)
; Enable VIM Mode
(global-evil-leader-mode)
(evil-mode 1)
(evil-leader/set-leader ",")
; Use evil-leader in magit and gnus mode
(setq evil-leader/no-prefix-mode-rx '("magit-.*-mode" "gnus-.*-mode"))
(evil-leader/set-key "t" 'helm-browse-project)
; Map escape to exit all modes
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
; Disable line wrapping
(setq-default truncate-lines t)
; UI Tweaks
(tool-bar-mode -1)
(scroll-bar-mode -1)
; Helm
(helm-mode 1)
(require 'helm-ls-git)
;; Ido
;(require 'flx-ido)
;(ido-mode 1)
;(ido-everywhere 1)
;(flx-ido-mode 1)
;;; disable ido faces to see flx highlights.
;(setq ido-enable-flex-matching t)
;(setq ido-use-faces nil)
;(setq projectile-enable-caching t)
;; Special GC Setting
;(setq gc-cons-threshold 20000000)
; Scala
; Load the ensime lisp code...
(add-to-list 'load-path "~/.emacs.d/ensime/elisp")
(require 'ensime)
(setq exec-path (append exec-path '("~/Work/universe/sbt")))
;; This step causes the ensime-mode to be started whenever
;; scala-mode is started for a buffer. You may have to customize this step
;; if you're not using the standard scala mode.
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
; Javascript
; https://github.com/mooz/js2-mode.git
(add-to-list 'load-path "~/.emacs.d/js2-mode")
(require 'js2-mode)
(add-hook 'js-mode-hook 'js2-minor-mode)
(add-hook 'js2-mode-hook 'ac-js2-mode)
(setq js2-highlight-level 3)
(add-to-list 'auto-mode-alist '("\\.json$" . js-mode))
(setq js2-missing-semi-one-line-override t)
(setq js-indent-level 2)
(setq js2-basic-offset 1) ; 2 spaces for indentation (if you prefer 2 spaces instead of default 4 spaces for tab)
(setq c-basic-offset 2)
;; add from jslint global variable declarations to js2-mode globals list
;; modified from one in http://www.emacswiki.org/emacs/Js2Mode
(defun my-add-jslint-declarations ()
(when (> (buffer-size) 0)
(let ((btext (replace-regexp-in-string
(rx ":" (* " ") "true") " "
(replace-regexp-in-string
(rx (+ (char "\n\t\r "))) " "
;; only scans first 1000 characters
(save-restriction (widen) (buffer-substring-no-properties (point-min) (min (1+ 1000) (point-max)))) t t))))
(mapc (apply-partially 'add-to-list 'js2-additional-externs)
(split-string
(if (string-match (rx "/*" (* " ") "global" (* " ") (group (*? nonl)) (* " ") "*/") btext)
(match-string-no-properties 1 btext) "")
(rx (* " ") "," (* " ")) t))
)))
(add-hook 'js2-post-parse-callbacks 'my-add-jslint-declarations)
;;; yasnippet
;;; should be loaded before auto complete so that they can work together
(require 'yasnippet)
(yas-global-mode 1)
;;; auto complete mod
;;; should be loaded after yasnippet so that they can work together
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
;;; set the trigger key so that it can work together with yasnippet on tab key,
;;; if the word exists in yasnippet, pressing tab will cause yasnippet to
;;; activate, otherwise, auto-complete will
(ac-set-trigger-key "TAB")
(ac-set-trigger-key "<tab>")
; Tern auto completion, install tern
; sudo npm install -g tern
(add-hook 'js-mode-hook (lambda () (tern-mode t)))
(eval-after-load 'tern
'(progn
(require 'tern-auto-complete)
(tern-ac-setup)))
; Gpicker
; git clone https://github.com/emacsmirror/gpicker.git 1 ↵ ✭
;(add-to-list 'load-path "~/.emacs.d/gpicker")
;(require 'gpicker)
;(setq exec-path (append exec-path '("~/.emacs.d/gpicker")))
; Powerline
; https://github.com/Dewdrops/powerline.git
(add-to-list 'load-path "~/.emacs.d/powerline")
(require 'powerline)
(powerline-center-evil-theme)
; Projectile Project Management
;(projectile-global-mode)
; Debug
;(setq debug-on-error t)
; Disable Stupid Bell
(setq ring-bell-function #'ignore)
(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-safe-themes (quote ("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
'(tool-bar-mode nil))
(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 (:family "Menlo" :foundry "nil" :slant normal :weight normal :height 110 :width normal)))))