-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.el
380 lines (334 loc) · 13.4 KB
/
config.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
380
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
(setq user-full-name "Austin Theriault"
user-mail-address "[email protected]")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-city-lights)
(setq doom-big-font-increment 3)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
(add-to-list 'default-frame-alist '(undecorated-round . t))
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;; (after! PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
;; accept completion from copilot and fallback to company
;;
;; General settings
;;
(setq vterm-timer-delay 0.001)
(setq +format-on-save-disabled-modes (add-to-list '+format-on-save-disabled-modes 'dune-mode))
;;
;; Package stuff
;;
(use-package! org
:config
(setq org-directory "~/org/"
org-default-notes-file "~/org/agenda/todo.org"
org-log-into-drawer t
org-log-done 'time
org-capture-templates
'(("t" "TODO" entry (file+headline "~/org/agenda/todo.org" "Anytime")
"* TODO %? %^G\n%T")
("i" "IDEA" entry (file "~/org/agenda/ideas.org")
"* IDEA %? %^G\n%T"))
org-todo-keywords '((sequence "TODO(t!)" "STRT(s!)" "WAIT(w@/!)" "IDEA(i)" "|" "DONE(d!)" "CANCELED(c@) REVISIT(r@)")
(sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)")
(sequence "|" "YES(y)" "NO(n)"))
)
(setq org-agenda-files '("~/org/agenda")
org-agenda-skip-scheduled-if-done t
org-agenda-skip-deadline-if-done t
org-agenda-include-deadlines t
org-agenda-block-separator nil
org-agenda-compact-blocks t
org-agenda-start-day nil ;; i.e. today
org-agenda-span 1
org-agenda-start-on-weekday nil)
(map! :leader :mode 'org-mode :desc "org-add-note" :n "m n" #'org-add-note)
(setq org-latex-src-block-backend 'minted
org-latex-custom-lang-environments
'((emacs-lisp "common-lispcode"))
org-latex-minted-options
'(("frame" "single")
("fontsize" "\\scriptsize")
("linenos" ""))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")))
(use-package! org-super-agenda
:after org-agenda
:init
(setq org-agenda-custom-commands
'(("c" "Super view"
((alltodo "" ((org-agenda-overriding-header "")
(org-super-agenda-groups
'(
(:name "Today - Stretch"
:and (:tag "today" :tag "stretch")
:order 2)
(:name "This Week - Stretch"
:and (:tag "thisweek" :tag "stretch")
:order 4)
(:name "Today"
:date today
:tag "today"
:order 1)
(:name "This Week"
:tag "thisweek"
:order 3)
(:name "Anytime"
:tag "anytime"
:order 5)
(:discard (:anything))))))
(alltodo "" ((org-agenda-overriding-header "")
(org-super-agenda-groups
'((:log t)
(:name "Due Today"
:deadline today
:order 6)
(:name "Due Soon"
:deadline future
:order 7)
(:name "Overdue"
:deadline past
:order 8)
(:discard (:anything))))))))))
:config
(map! :leader :desc "Agenda View" :n "a"
#'(lambda (&rest _)
(interactive)
(org-agenda nil "c")))
(let ((org-save-all (list
'org-refile
'org-todo
'org-archive-subtree
'org-archive-subtree-default)))
(dolist (fn org-save-all)
(advice-add fn :after
(lambda (&rest _)
(org-save-all-org-buffers)))))
(org-super-agenda-mode))
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-n" . 'copilot-next-completion)
("C-p" . 'copilot-previous-completion))
:config
(add-to-list 'copilot-indentation-alist '(tuareg-mode 2))
(add-to-list 'copilot-indentation-alist '(org-mode 2))
(add-to-list 'copilot-indentation-alist '(text-mode 2))
(add-to-list 'copilot-indentation-alist '(closure-mode 2))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2)))
(use-package! vlf
:config
(setq vlf-application 'always)
(map! :leader :desc "Open very large file with VLF" :n "f v" #'vlf))
(use-package! lsp-mode
:config
(setq lsp-progress-function 'lsp-on-progress-legacy
lsp-disabled-clients '((tuareg-mode . semgrep-ls))
lsp-semgrep-scan-jobs 10
lsp-rust-features "all"))
(use-package! jinx
:hook (emacs-startup . global-jinx-mode)
:config
(map!
:desc "jinx-correct" :n "z =" #'jinx-correct
:desc "jinx-correct-all" :n "z S" #'jinx-correct-all
)
)
(use-package! magit-delta
:hook (magit-mode . magit-delta-mode))
(use-package! poetry
:config
(setq poetry-tracking-strategy 'projectile))
(use-package! dap-mode
:hook (lsp-mode . dap-mode)
:config
(setq dap-auto-configure-features '(sessions locals breakpoints))
(map! :leader
(:prefix ("d" . "debug")
:desc "DAP Debug" "d" #'dap-debug
:desc "DAP Disconnect" "D" #'dap-disconnect
:desc "DAP Toggle Breakpoint" "b" #'dap-breakpoint-toggle
:desc "DAP Step In" "i" #'dap-step-in
:desc "DAP Step Out" "O" #'dap-step-out
:desc "DAP Step Over" "o" #'dap-next
:desc "DAP Restart" "r" #'dap-debug-restart
:desc "DAP Debug Last" "l" #'dap-debug-last
:desc "DAP Continue" "c" #'dap-continue
:desc "DAP Breakpoint Condition" "C" #'dap-breakpoint-condition
:desc "DAP UI Show" "u" #'dap-ui-show-many-windows
:desc "DAP UI Hide" "U" #'dap-ui-hide-many-windows))
(dap-ui-controls-mode 0))
(use-package! jsonnet-mode
:defer t
:config
(set-electric! 'jsonnet-mode :chars '(?\n ?: ?{ ?})))
(use-package! consult
:config
(map! :leader :n "P" #'yank-from-kill-ring)
(map! :leader :n "e" #'consult-flycheck)
(map! :leader :n "M" #'consult-mode-command)
)
;; Configure vetico mouse extension.
(use-package! vertico-mouse
:after vertico
:config
;; Enable vertico-mouse
(vertico-mouse-mode))
;; Configure vertico directory extension.
(use-package! vertico-directory
:after vertico
;; More convenient directory navigation commands
:bind (:map vertico-map
("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word))
;; Tidy shadowed file names
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
(use-package! ace-window
:config
(setq aw-background nil)
(map! :leader
(:prefix ("w" . "window")
:desc "Next Frame" "]" #'+evil/next-frame
:desc "Previous Frame" "[" #'+evil/previous-frame
:desc "Ace Window" "a" #'ace-window))
;; window switching
(mapc (lambda (x)
(let ((key (car x))
(val (cdr x)))
(map! :leader :desc (format "Switch to window ") :n (format "w %s" key)
(lambda ()
(interactive)
(let ((wnd (nth val (aw-window-list))))
(when wnd
(select-window wnd)
(select-frame-set-input-focus (selected-frame))))))))
'(("1" . 0) ("2" . 1) ("3" . 2) ("4" . 3) ("5" . 4)
("6" . 5) ("7" . 6) ("8" . 7) ("9" . 8)))
(ace-window-display-mode))
(use-package! undo-tree
:config
(defun +undo-tree-escape-hook nil "Exit undo tree"
(if (eq major-mode 'undo-tree-visualizer-mode)
(undo-tree-visualizer-quit))
)
:hook (doom-escape-hook . +undo-tree-escape-hook)
)
(use-package! git-link
:config
(map! :leader :desc "Copy git link" :n "g l" #'git-link-dispatch)
)
(use-package! vterm-toggle
:config
(map! :leader :desc "Toggle vterm" :n "o t" #'vterm-toggle-cd)
)
;;
;; after/hooks/conditions
;;
(after! doom-themes-ext-treemacs
(with-eval-after-load 'treemacs
(remove-hook 'treemacs-mode-hook #'doom-themes-hide-fringes-maybe)
(advice-remove #'treemacs-select-window #'doom-themes-hide-fringes-maybe)))
(after! dap-mode
(advice-add 'dap-ui-controls-mode :override #'ignore))
(add-hook! org-mode 'org-fragtog-mode)
;; File templates
(set-file-template! "\\.ml$" :trigger "__.ml" :mode 'tuareg-mode)
;;
;; custom functions
;;
(defun gpg-sign-string (message)
(shell-command-to-string
(format "echo \"%s\" | gpg --clearsign -o-" message))
)
(defun gpg-sign-comment (start end)
(interactive "r")
(let ((comment (buffer-substring-no-properties start end)))
(delete-region start end)
(insert (gpg-sign-string comment)))
)
;;
;; keybindings
;;
;; kitty
(map! :leader
(:prefix ("k" . "kitty")
:desc "Run a command in Kitty" "r" #'+kitty/run
:desc "Run region as command in Kitty" "R" #'+kitty/send-region
:desc "Rerun a command in Kitty" "k" #'+kitty/rerun
:desc "Run a a command in a new Kitty window" "n" #'+kitty/run-in-new-window
:desc "Run a command in a new Kitty tab" "t" #'+kitty/run-in-new-tab
:desc "Run a command in a new Kitty OS window" "o" #'+kitty/run-in-new-os-window
:desc "Launch a new Kitty window" "N" #'+kitty/new-window
:desc "Launch a new Kitty tab" "T" #'+kitty/new-window
:desc "Launch a new Kitty OS window" "O" #'+kitty/launch
:desc "CD to a directory in Kitty" "c" #'+kitty/cd
:desc "CD to current directory in Kitty" "d" #'+kitty/cd-to-here
:desc "CD to project root in Kitty" "p" #'+kitty/cd-to-project))
;; gpg
(map! :leader :desc "Sign region" :n "S" #'gpg-sign-comment)
;; projectile
(map! :leader :desc "Projectile find and replace" :n "p R" #'projectile-replace)
;; format
(map! :leader :desc "Format buffer" :n "b f" #'+format/buffer)
;; treemacs
(map! :leader :desc "Treemacs" :n "f t" #'treemacs)