-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_emacs
More file actions
274 lines (231 loc) · 7.28 KB
/
dot_emacs
File metadata and controls
274 lines (231 loc) · 7.28 KB
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
;;; package --- Summary
;;; Commentary:
;;; Code:
;; editor
(setq select-enable-clipboard t)
(setq dired-listing-switches "-aBhl --group-directories-first")
(setq inhibit-startup-screen t)
(setq frame-title-format
'((:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))
(:eval (if (buffer-modified-p)
" *"))
" - Emacs")
)
;; (setq debug-on-error t)
(setq-default linum-format "%d ") ;; Integer followed by space
(setq-default mode-line-format
'("%e"
mode-line-front-space
mode-line-mule-info
mode-line-client
mode-line-modified
mode-line-remote
mode-line-frame-identification
;; mode-line-buffer-identification
(:eval (abbreviate-file-name (buffer-file-name)))
" "
mode-line-position
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
mode-line-end-spaces))
(setq backup-directory-alist '(("." . "~/.emacs_backups")))
;; (setq-default company-quickhelp-color-background "#000000")
(setq-default web-mode-engines-alist
'(("go" . "\\.tmpl\\'"))
)
(setq-default prettier-js-use-modules-bin t)
(setq-default typescript-indent-level 2)
(setq-default typescript-auto-indent-flag t)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(electric-pair-mode t)
;; (global-linum-mode t)
(global-display-line-numbers-mode 1)
;; Alternatively, to use it only in programming modes:
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(add-to-list 'default-frame-alist '(height . 50))
(add-to-list 'default-frame-alist '(width . 100))
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono"))
;; keybindings
(global-set-key (kbd "C-x C-b") 'helm-mini)
(global-set-key (kbd "M-p") 'backward-paragraph)
(global-set-key (kbd "M-n") 'forward-paragraph)
(global-set-key (kbd "C-<return>") 'browse-url-at-point)
(global-set-key (kbd "C-c C-/") 'comment-line)
(global-set-key (kbd "C-c C-<tab>") 'previous-buffer)
(global-set-key (kbd "C-c g") 'god-mode-all)
(global-set-key (kbd "C-,") 'god-mode-all)
;; proxy
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10\\..*\\|192\\.168\\..*\\)")
("http" . "127.0.0.1:1089")
("https" . "127.0.0.1:1089")))
;; melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(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.
'(package-selected-packages
'(company company-box company-quickhelp docker
docker-compose-mode dockerfile-mode dumb-jump emmet-mode
expand-region flycheck go-mode god-mode helm keyfreq
lsp-mode lsp-ui magit multiple-cursors neotree orderless
prettier-js projectile projectile-rails restart-emacs rg
ripgrep tide typescript-mode use-package web-mode which-key
winum yafolding yasnippet zeno-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.
)
(load-theme 'zeno t)
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package lsp-mode
:ensure t
:init
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
;; (setq lsp-keymap-prefix "C-c l")
(setq lsp-auto-guess-root t)
:hook (go-mode . lsp-deferred)
:commands (lsp lsp-deferred)
:config
(setq lsp-ui-doc-enable t
lsp-ui-doc-position 'at-point
lsp-ui-doc-header t
lsp-ui-doc-include-signature t
lsp-ui-doc-delay 1
lsp-ui-doc-show-with-cursor t)
(use-package lsp-ui-doc))
(defun my-go-mode-hook ()
;; Use goimports instead of go-fmt
(setq-default gofmt-command "goimports")
;; Call Gofmt before saving
(add-hook 'before-save-hook 'gofmt-before-save)
(unbind-key "C-c C-d" 'go-mode-map)
;; Customize compile command to run go build
;; (if (not (string-match "go" compile-command))
;; (set (make-local-variable 'compile-command)
;; "go build -v && go test -v && go vet"))
;; Godef jump key binding
;; (local-set-key (kbd "M-.") 'godef-jump)
;; (local-set-key (kbd "M-*") 'pop-tag-mark)
)
(use-package go-mode
:ensure t
:hook ((go-mode . my-go-mode-hook)
(go-mode . hs-minor-mode)))
(use-package helm
:ensure t
:config
(helm-mode 1)
:bind (("M-x" . helm-M-x)
("C-x C-b" . helm-mini)
("C-x C-f" . helm-find-files)))
(use-package multiple-cursors
:ensure t
:bind (("C-c m c" . mc/edit-lines)
("C-c m n" . mc/mark-next-like-this)
("C-c m p" . mc/mark-previous-like-this)
("C-c m a" . mc/mark-all-like-this)))
(use-package projectile
:ensure t
:config
(projectile-mode +1)
:bind
(("C-c p" . projectile-command-map)))
;; (use-package neotree
;; :ensure t
;; :bind(("C-c n" . neotree-toggle)))
(use-package yafolding
:ensure t
:config
(yafolding-mode 1)
:bind
(("C-{" . yafolding-hide-element)
("C-}" . yafolding-show-element)))
;; (use-package god-mode
;; :ensure t
;; ;; :init
;; ;; (god-mode-all)
;; :hook (after-init . god-mode)
;; :bind (("C-c g" . god-mode-all)
;; ("<escape>" . god-mode-all)))
(use-package which-key
:ensure t
:config
(which-key-mode +1))
(use-package company
:ensure t
:hook (after-init . global-company-mode))
(use-package company-box
:ensure t
:hook (company-mode . company-box-mode))
(use-package company-quickhelp
:ensure t
:config
:hook (company-mode . company-quickhelp-mode))
(use-package yasnippet
:ensure t
:config
(yas-global-mode 1))
(use-package expand-region
:ensure t
:bind (("C-'" . er/expand-region)))
(use-package view
:bind (:map view-mode-map
("n" . next-line)
("p" . previous-line)
("v" . scroll-up-command)
("M-v" . scroll-down-command)))
(use-package tide
:ensure t
:after (typescript-mode company flycheck)
:hook ((typescript-mode . tide-setup)
(typescript-mode . tide-hl-identifier-mode)
(before-save . tide-format-before-save)))
(use-package web-mode
:ensure t
:mode (("\\.tmpl\\'" . web-mode)))
(use-package typescript-mode
:ensure t
:mode (("\\.js\\'" . typescript-mode)))
(use-package emmet-mode
:ensure t
:hook ((web-mode . emmet-mode)))
(use-package winum
:ensure t
:config (winum-mode 1))
(use-package prettier-js
:ensure t
:hook (web-mode . prettier-js-mode))
(require 'keyfreq)
(keyfreq-mode 1)
(keyfreq-autosave-mode 1)
(require 'bind-key)
(bind-key* "C-c C-d" 'mc/mark-next-like-this)
(bind-key* "C-c C-f" 'projectile-find-file)
(bind-key* "C-c C-r" 'rg)
(provide '.emacs)
(put 'narrow-to-region 'disabled nil)
;; (add-hook 'go-mode-hook 'lsp-deferred)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
(add-hook 'html-mode-hook 'emmet-mode)
;; (add-hook 'minibuffer-setup-hook )
;; (add-hook 'after-init-hook 'global-company-mode)
;;; .emacs ends here