-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
379 lines (314 loc) · 11.8 KB
/
init.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
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
(server-start)
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(require 'use-package)
(setq use-package-always-ensure t)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tooltip-mode -1)
(set-fringe-mode 10)
(use-package all-the-icons)
(use-package treemacs-all-the-icons
:after treemacs)
(use-package treemacs
:defer t
:init
(setq treemacs-follow-after-init t
treemacs-is-never-other-window t)
:config
(treemacs-follow-mode -1)
(require 'treemacs-all-the-icons)
(treemacs-load-theme "all-the-icons"))
(use-package treemacs-evil
:defer t
:init
:after treemacs (require 'treemacs-evil))
(use-package treemacs-projectile
:after treemacs)
(use-package treemacs-magit
:after treemacs magit)
(use-package lsp-treemacs
:after(treemacs lsp))
(use-package doom-themes
:demand t)
(setq doom-themes-enable-bold t
doom-themes-enable-italics t)
(load-theme 'doom-outrun-electric t)
(use-package doom-modeline :init (doom-modeline-mode 1))
(column-number-mode)
(setq display-line-numbers-type 'relative)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'conf-mode-hook 'display-line-numbers-mode)
(display-time-mode 1)
(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 240 :weight 'medium)
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font Mono" :height 240 :weight 'medium)
(set-face-attribute 'variable-pitch nil :font "IBM Plex Sans" :height 250 )
(defun mj/set-font-faces()
(message "Loading fonts!")
(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 240 :weight 'medium)
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font Mono" :height 240 :weight 'medium)
(set-face-attribute 'variable-pitch nil :font "IBM Plex Sans" :height 250 ))
(if (daemonp) (add-hook 'server-after-make-frame-hook (lambda (frame) (setq doom-modeline-icon t) (with-selected-frame frame (mj/setfont-faces)))) (mj/set-font-faces))
(use-package centaur-tabs)
(use-package ligature
:load-path "/home/mjolnir/.emacs/ligature.el"
:config
;; Enable the "www" ligature in every possible major mode
(ligature-set-ligatures 't '("www"))
;; Enable traditional ligature support in eww-mode, if the
;; `variable-pitch' face supports it
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
;; Enable all Cascadia Code ligatures in programming modes
(ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
))
;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'.
(global-ligature-mode t))
(use-package dired
:ensure nil
:commands (dired dired-jump)
:bind (("C-x C-j" . dired-jump))
:config
(evil-collection-define-key 'normal 'dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file))
(use-package vertico
:bind (:map vertico-map
("C-j" . vertico-next)
("C-k" . vertico-previous)
:map minibuffer-local-map
("M-h" . backward-kill-word))
:custom
(vertico-cycle t)
:init
(vertico-mode))
(use-package marginalia
:bind (("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
:init
(marginalia-mode))
(use-package all-the-icons-completion
:hook ('marginalia-mode-hook #'all-the-icons-completion-marginalia-setup))
(all-the-icons-completion-mode)
(use-package savehist
:init
(savehist-mode))
(use-package consult
:bind (("C-s" . consult-line)))
(use-package orderless
:init
(setq completion-styles '(orderless)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
;;(use-package swiper)
;; (use-package ivy
;; :diminish
; :bind (("C-s" . swiper)
; :map ivy-minibuffer-map
; ("TAB" . ivy-alt-done)
; ("C-l" . ivy-alt-done)
; ("C-k" . ivy-next-line)
; ("C-j" . ivy-previous-line)
; :map ivy-switch-buffer-map
; ("C-k" . ivy-previous-line)
; ("C-l" . ivy-done)
;; ("C-d" . ivy-switch-buffer-kill)
;; :map ivy-reverse-i-search-map
;; ("C-k" . ivy-previous-line)
;; ("C-d" . ivy-previous-i-search-kill))
;; :config
;; (ivy-mode 1))
;; (use-package ivy-rich
; :init
; (ivy-rich-mode 1))
;; (use-package counsel
;; :bind (("M-x" . counsel-M-x)
;; ("C-x b" . counsel-ibuffer)
;; ("C-x C-f" . counsel-find-file)
;; :map minibuffer-local-map
;; ("C-r" . counsel-minibuffer-history)))
(use-package helpful
:custom
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-function-variable #'helpful-variable)
:bind
([remap-desrcibe-function] . counsel-describe-function)
([remap-describe-command] . helpful-command)
([remap-describe-variable] . counsel-describe-variable)
([remap-describe-key] . helpful-key))
(use-package flycheck
:init
(global-flycheck-mode t))
(use-package company
:config
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3))
(use-package company-box
:hook (company-mode . company-box-mode))
(use-package vterm)
(use-package rainbow-delimiters
:hook(prog-mode . rainbow-delimiters-mode))
(use-package smartparens)
(smartparens-global-mode t)
(show-paren-mode 1)
(use-package evil
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1)
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
(evil-set-initial-state 'message-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal))
(use-package evil-collection
:after evil
:config
(evil-collection-init))
(use-package which-key
:init (which-key-mode)
:config
(setq which-key-idle-delay 0.25))
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(use-package general)
(defun mj/lsp-mode-setup ()
(setq company-minimum-prefix-length 1))
(use-package lsp-mode
:commands (lsp lsp-deferred)
:hook (lsp-mode . mj/lsp-mode-setup)
:init
(setq lsp-keymap-prefix "C-c l")
:config
(lsp-enable-which-key-integration t))
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
:config
(setq lsp-ui-doc-position 'bottom))
(setq gc-cons-threshold 100000000)
(use-package typescript-mode
:mode "\\.ts\\'"
:hook (typescript-mode . lsp-deferred)
:config
(setq typescript-indent-level 2))
(use-package lsp-julia
:after lsp-mode)
(use-package julia-mode
:hook (julia-mode . lsp-deferred)
:interpreter "julia")
(use-package julia-repl
:hook (julia-mode . julia-repl-mode))
(use-package python-mode
:hook (python-mode . lsp-deferred)
:custom
(python-shell-interpreter "python3"))
(use-package haskell-mode)
(use-package rustic
:mode ("\\.rs$" . rustic-mode)
:hook (rustic-mode . lsp-deferred)
:init
(add-to-list 'org-src-lang-modes ("rust" . rustic))
:config
(setq rustic-indent-method-chian t)
(setq rustic-lsp-client 'rust-analyzer)
(defun mj/org-font-setup ()
;; Set faces for heading levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.1)
(org-level-6 . 1.1)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
(set-face-attribute (car face) nil :font "IBM Plex Sans" :weight 'regular :height (cdr face)))
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
(defun mj/org-mode-setup()
(mj/org-font-setup)
(variable-pitch-mode 1)
(auto-fill-mode 0)
(visual-line-mode 1)
(setq-default truncate-lines t)
(setq evil-auto-indent nil)
(org-indent-mode))
(use-package org-superstar
:after org
:hook (org-mode . org-superstar-mode)
:custom
(org-superstar-remove-leading-stars t)
(org-superstar-headline-bullets-list '("☕" "☀" "☎" "☞" "☭" "☯" "☮")))
(use-package org
:hook (org-mode . mj/org-mode-setup)
:config
(setq org-src-fontify-natively t)
(setq org-ellipsis " ▾")
(setq org-agenda-start-with-time-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
(setq org-agenda-files
'("~/Org/Tasks.org")))
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
(setq org-confirm-babel-evaluate nil)
(with-eval-after-load 'org
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t))))
(defun mj/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/.emacs/Emacs.org"))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'mj/org-babel-tangle-config)))
(use-package projectile
:diminish projectile-mode
:config (projectile-mode)
:bind-keymap
("C-c p" . projectile-command-map)
:init
(when (file-directory-p "~/Development")
(setq projectile-project-search-path '("~/Development")))
(setq projectile-switch-project-action #'projectile-dired))
(setq auth-sources '("~/.authinfo"))
(use-package magit
:commands (magit-status magit-get-current-branch)
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(use-package forge
:after magit)