-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.el
254 lines (235 loc) · 9.17 KB
/
setup.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
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
;; Set up hooks
(add-hook 'myspacemacs-layers-hook 'myspacemacs/layers)
(add-hook 'myspacemacs-init-hook 'myspacemacs/init)
(add-hook 'myspacemacs-user-init-hook 'myspacemacs/user-init)
(add-hook 'myspacemacs-user-config-hook 'myspacemacs/user-config)
(defun myspacemacs/layers ()
"Configuration layers declaration."
(setq-default
dotspacemacs-configuration-layers
'((auto-completion
:variables
auto-completion-enable-help-tooltip t
auto-completion-enable-snippets-in-popup t
auto-completion-enable-sort-by-usage t
auto-completion-return-key-behavior nil
auto-completion-tab-key-behavior 'complete)
clojure
colors
command-log
emacs-lisp
git-plus
(go
:variables
go-tab-width 2
gofmt-command "goimports")
graphviz
helm
html
javascript-plus
lua
markdown-plus
(org-plus
:variables
org-plus-html-pygments-style "xcode"
org-plus-pdf-no-tex t
org-plus-use-pygments t
org-enable-org-journal-support t
org-enable-reveal-js-support t
org-journal-dir "~/org/journal"
org-journal-date-format "%F %a"
org-journal-date-prefix "#+TITLE: "
org-journal-time-prefix "* "
org-want-todo-bindings t)
osx
plantuml
restclient
(shell
:variables
shell-default-shell 'eshell)
shell-scripts
(spell-checking
:variables
spell-checking-enable-by-default nil)
syntax-checking
(theming
:variables
theming-modifications `((doom-one
(linum-relative-current-face :underline nil)
(modeline-highlight :inherit nil)
(powerline-active2 :inherit powerline-active0)
(powerline-inactive2 :inherit powerline-inactive0)
(sp-show-pair-match-face :foreground "#86dc2f"))
(doom-one-light
(linum-relative-current-face :underline nil)
(modeline-highlight :inherit nil)
(powerline-active2 :inherit powerline-active0)
(powerline-inactive2 :inherit powerline-inactive0)
(sp-show-pair-match-face :background nil))
(spacemacs-dark
(linum-relative-current-face :bold nil
:underline nil))
(spacemacs-light
(linum-relative-current-face :bold nil
:underline nil))))
(ui-plus
:variables
ui-plus-centered-cursor-blacklist '(spacemacs-buffer-mode
eshell-mode
shell-mode
term-mode))
vim-empty-lines
vimscript
yaml)
dotspacemacs-distribution 'spacemacs))
(defun myspacemacs/init ()
"Initialization function."
(setq-default
dotspacemacs-default-font `(,myspacemacs-fixed-font
:size ,myspacemacs-font-size)
dotspacemacs-editing-style 'vim
dotspacemacs-emacs-leader-key "M-m"
dotspacemacs-emacs-command-key "SPC"
dotspacemacs-enable-lazy-installation nil
dotspacemacs-enable-paste-transient-state t
dotspacemacs-ex-command-key ";"
dotspacemacs-frame-title-format "Spacemacs"
dotspacemacs-highlight-delimiters 'current
dotspacemacs-leader-key "SPC"
dotspacemacs-line-numbers (append '(:enabled-for-modes)
myspacemacs-prog-based-modes
'(:relative t))
dotspacemacs-mode-line-theme `(spacemacs
:separator ,(if (display-graphic-p) 'bar nil)
:separator-scale ,myspacemacs-powerline-scale)
dotspacemacs-mode-line-unicode-symbols (display-graphic-p)
dotspacemacs-persistent-server (display-graphic-p)
dotspacemacs-scratch-mode 'fundamental-mode
dotspacemacs-startup-lists '((recents . 5)
(projects . 5)
bookmarks)
dotspacemacs-visual-line-move-text t
dotspacemacs-themes (if (display-graphic-p)
'(doom-one doom-one-light)
'(spacemacs-dark spacemacs-light))))
(defun myspacemacs/user-init ()
"Initialization function for user code."
(setq-default
column-number-indicator-zero-based (version< emacs-version "26")
create-lockfiles nil
display-time-default-load-average nil
display-time-format "%a %m-%d %I:%M"
evil-echo-state nil
evil-move-cursor-back nil
frame-resize-pixelwise t
helm-mode-handle-completion-in-region nil
line-spacing 0
term-term-name "screen-256color"
whitespace-line-column myspacemacs-max-column)
(when (eq system-type 'windows-nt)
(setq-default
projectile-enable-caching t
projectile-indexing-method 'native))
;; Emacs 26
(unless (fboundp 'display-buffer-in-major-side-window)
(defalias
'display-buffer-in-major-side-window
'window--make-major-side-window))
;; Fake tmux being set so it is not run in shells
(setenv "TMUX" "faux"))
(defun myspacemacs/user-config ()
"Configuration function for user code."
(setq-default
frame-title-format '((:eval (myspacemacs/frame-title-format)))
fill-column myspacemacs-max-column
grep-highlight-matches t
line-spacing 0)
;; Set font families
(set-face-attribute 'variable-pitch nil :family myspacemacs-variable-font)
(set-face-attribute 'fixed-pitch nil :family myspacemacs-fixed-font)
;; Set up eshell aliases
(with-eval-after-load 'em-alias
(eshell/alias "hgrep" "history | grep $*")
(eshell/alias "la" "ls -lAh $*"))
;; Additional hooks
(add-hook 'conf-mode-hook 'myspacemacs/prog-mode)
(add-hook 'css-mode-hook 'myspacemacs/css-mode)
(add-hook 'css-mode-hook 'myspacemacs/prog-mode)
(add-hook 'prog-mode-hook 'myspacemacs/prog-mode)
(add-hook 'text-mode-hook 'myspacemacs/text-mode)
;; Additional patterns to match files to major modes
(add-to-list 'auto-mode-alist '("\\.svg$" . image-mode-as-text))
(add-to-list 'auto-mode-alist '("/\\.mbsyncrc$" . conf-mode))
(add-to-list 'auto-mode-alist '("/\\.npmignore$" . gitignore-mode))
(add-to-list 'auto-mode-alist '("/Brewfile$" . ruby-mode))
;; Additional keybinds
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-visual-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-visual-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "C-/") 'hippie-expand)
(define-key evil-insert-state-map (kbd "C-/") 'hippie-expand)
(define-key global-map (kbd "C-h h") nil)
(define-key global-map (kbd "C-q") nil)
(spacemacs/set-leader-keys
";" 'evilnc-comment-or-uncomment-lines
"qd" nil
"qD" nil)
;; When running in non-GUI mode:
;; - Disable restart command shortcuts in daemon mode
;; - Add a space between line numbers and content
(unless (display-graphic-p)
(when (daemonp)
(spacemacs/set-leader-keys
"qr" nil
"qR" nil
"qt" nil))
(with-eval-after-load 'linum
(when (stringp linum-format)
(setq linum-format (concat linum-format " "))))
(with-eval-after-load 'linum-relative
(when (stringp linum-relative-format)
(setq linum-relative-format (concat linum-relative-format " ")))))
;; Force helm to load
(helm-mode 1)
;; Make tweaks to spacemacs
(spaceline-toggle-buffer-position-off)
(spaceline-toggle-buffer-size-off)
(spaceline-toggle-hud-off)
(spacemacs/toggle-camel-case-motion-globally-on)
(spacemacs/toggle-mode-line-minor-modes-off))
(defun myspacemacs/css-mode ()
"Configure css mode."
(smartparens-mode t))
(defun myspacemacs/frame-title-format ()
"Custom frame title."
(let ((filename (if (and buffer-file-truename (projectile-project-p))
(file-relative-name buffer-file-truename
(projectile-project-root))
buffer-file-truename))
(hostname (file-remote-p default-directory 'host))
(project (and (projectile-project-p) (projectile-project-name))))
(cond
((and project hostname filename)
(concat "[" project "@" hostname "] " filename))
((and project hostname)
(concat "[" project "@" hostname "]"))
((and project filename)
(concat "[" project "] " filename))
((and hostname filename)
(concat "[@" hostname "] " filename))
(project (concat "[" project "]"))
(hostname (concat "[@" hostname "]"))
(filename filename)
(t "Spacemacs"))))
(defun myspacemacs/prog-mode ()
"Configure program mode."
(spacemacs/toggle-truncate-lines-on)
(rainbow-mode t))
(defun myspacemacs/text-mode ()
"Configure text mode."
(if (member major-mode myspacemacs-prog-based-modes)
(myspacemacs/prog-mode)
(spacemacs/toggle-truncate-lines-off)
(toggle-word-wrap t)
(variable-pitch-mode t)))