-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgs-dev.el
500 lines (436 loc) · 13.8 KB
/
gs-dev.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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
;;; -*- lexical-binding: t -*-
(use-package treesit
:custom
(treesit-font-lock-level 4))
(use-package org-src
:config
(gs-101/add-many-to-list 'org-src-lang-modes
'(("bash" . bash-ts)
("C" . c-ts)
("clojure" . clojure-ts)
("cmake" . cmake-ts)
("csharp" . csharp-ts)
("css" . css-ts)
("dart" . dart-ts)
("dockerfile" . dockerfile-ts)
("go" . go-ts)
("html" . mhtml-ts)
("java" . java-ts)
("js" . js-ts)
("json" . json-ts)
("nix" . nix-ts)
("python" . python-ts)
("ruby" . ruby-ts)
("rust" . rust-ts)
("toml" . toml-ts)
("yaml" . yaml-ts))))
(use-package treesit-auto
:vc (:url "https://github.com/gs-101/treesit-auto" :branch custom)
:config
(global-treesit-auto-mode)
(treesit-auto-add-to-auto-mode-alist 'all)
:custom
(treesit-auto-install t)
:ensure t)
(use-package git-commit-ts-mode
:vc (:url "https://github.com/danilshvalov/git-commit-ts-mode")
:ensure t)
(use-package magit
:after git-commit-ts-mode magit
:custom
(git-commit-major-mode 'git-commit-ts-mode))
(use-package compile
:bind
(:map compilation-mode-map
("n" . next-error-no-select)
("p" . previous-error-no-select)
("q" . kill-buffer-and-window))
:custom
(compilation-auto-jump-to-first-error t)
(compilation-max-output-line-length nil)
(compilation-scroll-output t)
(compilation-skip-threshold 2)
:defer t
:hook
(compilation-mode . goto-address-mode)
(compilation-filter . ansi-color-compilation-filter))
(use-package compile
:after rust-ts-mode
:config
(push '(cargo "^\\ \\ -->\\ \\([/a-z_\\.]+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3)
compilation-error-regexp-alist-alist)
(push 'cargo compilation-error-regexp-alist))
(use-package devdocs
:vc (:url "https://github.com/astoff/devdocs.el")
:ensure t
:bind
(("C-h D" . devdocs-lookup)))
(use-package diff-mode
:custom
(diff-add-log-use-relative-names t)
:defer t)
(use-package editorconfig
:hook
(prog-mode . editorconfig-mode))
(use-package eglot
:config
(add-to-list 'eglot-server-programs
'((c-ts-mode c++-ts-mode) . ("clangd"
"--all-scopes-completion"
"--background-index"
"--clang-tidy"
"--completion-style=detailed")))
:custom
(eglot-autoshutdown t)
(eglot-connect-timeout nil)
(eglot-sync-connect nil)
:defer t)
(use-package eglot-codelens
:vc (:url "https://github.com/Gavinok/eglot-codelens")
:hook
(eglot-managed-mode . eglot-codelens-mode)
:ensure t)
(use-package eglot-x
:vc (:url "https://github.com/nemethf/eglot-x")
:after eglot
:config
(eglot-x-setup)
:custom
(eglot-x-enable-server-status nil)
(eglot-x-enable-menu nil)
:demand t
:ensure t)
(use-package eglot-supplements
:vc (:url "https://codeberg.org/harald/eglot-supplements")
:defer t
:ensure t)
(use-package eglot-cthier
:after eglot
:bind
(:map eglot-mode-map
("C-c e H" . eglot-cthier-request-call-hierarchy)))
(use-package eglot-marocc
:after eglot
:bind
(:map eglot-mode-map
("C-c e h" . eglot-marocc-request-highlights)
("C-c e n" . eglot-marocc-goto-next-highlight)
("C-c e p" . eglot-marocc-goto-previous-highlight)))
(use-package eglot-inactive-regions
:vc (:url "https://github.com/fargiolas/eglot-inactive-regions")
:ensure t
:custom
(eglot-inactive-regions-style 'darken-foreground)
(eglot-inactive-regions-opacity 0.3)
:hook
(eglot-connect . eglot-inactive-regions-mode))
(use-package eldoc
:custom
(eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
(eldoc-echo-area-use-multiline-p nil)
(eldoc-idle-delay 0))
(use-package eglot-signature-eldoc-talkative
:vc (:url "https://codeberg.org/mekeor/eglot-signature-eldoc-talkative")
:after eglot
:config
(advice-add #'eglot-signature-eldoc-function :override #'eglot-signature-eldoc-talkative)
:ensure t)
(use-package elec-pair
:hook
(minibuffer-mode . electric-pair-local-mode)
(prog-mode . electric-pair-local-mode))
(use-package flymake
:hook
(prog-mode . flymake-mode))
(use-package flymake-collection
:ensure t
:config
(push '((c-mode c-ts-mode) flymake-collection-gcc (flymake-collection-clang :disabled t)) flymake-collection-hook-config)
(push '((python-mode python-ts-mode) flymake-collection-flake8 (flymake-collection-pycodestyle :disabled t)) flymake-collection-hook-config)
:hook
(flymake-mode . flymake-collection-hook-setup))
(use-package clojure-ts-mode
:vc (:url "https://github.com/clojure-emacs/clojure-ts-mode")
:custom
(clojure-ts-comment-macro-font-lock-body t)
(clojure-ts-indent-style 'fixed)
(clojure-ts-toplevel-inside-comment-form t)
:defer t
:ensure t)
(use-package cider
:vc (:url "https://github.com/clojure-emacs/cider")
:after clojure-ts-mode
:bind
(:map cider-mode-map
("C-c C-p" . cider-jack-in-clj))
:ensure t
:hook
(clojure-ts-mode . cider-mode))
(use-package css-mode
:custom
;; It's two everywhere, really.
(css-indent-offset 2))
(use-package dart-ts-mode
:vc (:url "https://github.com/50ways2sayhard/dart-ts-mode")
:defer t
:ensure t)
(use-package flutter
:bind
(:map dart-ts-mode-map
([remap compile] . flutter-run-or-hot-reload)
("C-c C-c" . flutter-run-or-hot-reload))
:config
(defcustom gs-101/flutter-hot-reload-mode-lighter " Flutter Hot Reload"
"Lighter for `gs-101/flutter-hot-reload-mode'."
:type '(choice :tag "Lighter" (const :tag "No lighter" nil) string)
:group 'flutter)
(define-minor-mode gs-101/flutter-hot-reload-mode
"Minor mode for running hot reload on save.
Only runs if a `flutter' buffer already exits."
:lighter gs-101/flutter-hot-reload-mode-lighter
(if (and gs-101/flutter-hot-reload-mode (get-buffer "*Flutter*"))
(add-hook 'after-save-hook #'flutter-hot-reload nil 'local)
(remove-hook 'after-save-hook #'flutter-hot-reload 'local)))
:ensure t
:hook
(dart-ts-mode . gs-101/flutter-hot-reload-mode))
(use-package go-ts-mode
:bind
(:map go-ts-mode-map
("C-c m t f" . go-ts-mode-test-this-file)
("C-c m t p" . go-ts-mode-test-this-package)
("C-c m t ." . go-ts-mode-test-this-function-at-point))
:defer t)
(use-package hasktell-ts-mode
:vc (:url "https://codeberg.org/pranshu/haskell-ts-mode"))
(use-package hyprlang-ts-mode
:vc (:url "https://github.com/Nathan-Melaku/hyprlang-ts-mode")
:ensure t)
(use-package lisp
:bind
(:map lisp-mode-map
("C-c C-p" . run-lisp))
:custom
(inferior-lisp-program "sbcl")
(narrow-to-defun-include-comments t)
:defer t)
(use-package nix-ts-mode
:vc (:url "https://github.com/nix-community/nix-ts-mode")
:ensure t
:defer t)
;; Library
(use-package pg
:vc (:url "https://github.com/emarsden/pg-el/")
:ensure t)
(use-package pgmacs
:vc (:url "https://github.com/emarsden/pgmacs")
:defer t
:ensure t)
(use-package python
:custom
(python-indent-guess-indent-offset-verbose nil)
:defer t)
(use-package envrc
:vc (:url "https://github.com/purcell/envrc")
:ensure t
:init
(envrc-global-mode))
(use-package cargo-transient
:vc (:url "https://github.com/peterstuart/cargo-transient")
:after rust-ts-mode
:bind
(:map rust-ts-mode-map
("C-c C-c" . compile)
("C-c C-p" . cargo-transient))
:ensure t
:custom
(cargo-transient-buffer-name-function #'project-prefixed-buffer-name))
(use-package arei
:when (gs-101/guix-p)
:vc (:url "https://git.sr.ht/~abcdw/emacs-arei")
:after scheme
:ensure t)
(use-package vue-ts-mode
:vc (:url "https://github.com/8uff3r/vue-ts-mode")
:defer t
:ensure t)
(use-package sh-script
:bind
(:map bash-ts-mode-map
("C-c C-p" . ansi-shell))
(:map sh-mode-map
("C-c C-p" . ansi-shell))
:defer t)
(use-package smerge-mode
:init
(smerge-mode))
(use-package subword
:hook
(prog-mode . superword-mode))
(use-package aggressive-indent
:vc (:url "https://github.com/Malabarba/aggressive-indent-mode")
:config
(defun gs-101/aggressive-indent-mode-lisp ()
"Enable `aggressive-indent-mode' in Lisp modes."
(when (string-match-p "clojure.*-mode\\'" (symbol-name major-mode))
(aggressive-indent-mode))
(when (string-match-p "lisp.*-mode\\'" (symbol-name major-mode))
(aggressive-indent-mode))
(when (derived-mode-p 'scheme-mode)
(aggressive-indent-mode)))
:ensure t
:hook
(mhtml-ts-mode . aggressive-indent-mode)
(prog-mode . gs-101/aggressive-indent-mode-lisp))
(use-package apheleia
:vc (:url "https://github.com/radian-software/apheleia")
:ensure t
:config
;; Enabling code simplification for Go.
(setf (alist-get 'gofmt apheleia-formatters) '("gofmt" "-s"))
:hook
(prog-mode . apheleia-mode))
(use-package combobulate
:vc (:url "https://github.com/mickeynp/combobulate")
:custom
(combobulate-key-prefix "C-z t c")
:ensure t
:hook
(prog-mode . combobulate-mode))
(use-package dape
:vc (:url "https://github.com/svaante/dape")
:defer t
:ensure t
:hook
(dape-display-source . pulse-momentary-highlight-one-line))
(use-package debbugs
:ensure t)
(use-package exercism
:vc (:url "https://github.com/anonimitoraf/exercism.el")
:commands
(exercism)
:custom
(exercism--workspace
(convert-standard-filename
(expand-file-name "study/exercism/" gs-101/projects-code-directory)))
:defer t
:ensure t)
(use-package git-modes
:vc (:url "https://github.com/magit/git-modes")
:defer t
:ensure t)
(use-package leetcode
:vc (:url "https://github.com/kaiwk/leetcode.el")
:custom
(leetcode-directory
(convert-standard-filename
(expand-file-name "study/leetcode-solutions/" gs-101/projects-code-directory)))
(leetcode--paid "$")
(leetcode-save-solutions t)
:defer t
:ensure t)
(use-package magit
:vc (:url "https://github.com/magit/magit")
:bind
("C-c v B" . magit-blame)
("C-c v C" . magit-clone)
("C-c v /" . magit-dispatch)
("C-c v F" . magit-fetch)
("C-c M-g" . magit-file-dispatch)
("C-c v x" . magit-file-delete)
("C-c v ." . magit-file-dispatch)
("C-c v L" . magit-log)
("C-c v g" . magit-status)
("C-c v G" . magit-status-here)
("C-c v c c" . magit-commit)
("C-c v c f" . magit-commit-fixup)
("C-c v l s" . magit-list-submodules)
:custom
(magit-diff-refine-hunk t)
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
:ensure t
:hook
(magit-mode . magit-wip-mode)
(magit-process-find-password-functions . magit-process-password-auth-source))
(use-package forge
:vc (:url "https://github.com/magit/forge")
:after magit
:bind
("C-c v '" . forge-dispatch)
("C-c v c i" . forge-create-issue)
("C-c v c p" . forge-create-pullreq)
("C-c v f c" . forge-browse-commit)
("C-c v f i" . forge-browse-issue)
("C-c v f p" . forge-browse-pullreq)
("C-c v l i" . forge-list-issues)
("C-c v l n" . forge-list-notifications)
("C-c v l p" . forge-list-pullreqs)
("C-c v l r" . forge-list-repositories)
:ensure t)
(use-package orgit
:vc (:url "https://github.com/magit/orgit")
:after magit org
:bind
(:map magit-mode-map
("C-c m l s" . org-store-link))
:ensure t)
(use-package package-lint
:ensure t)
(use-package package-lint-flymake
:after package-lint flymake
:ensure t
:hook
(emacs-lisp-mode . package-lint-flymake-setup))
(use-package puni
:vc (:url "https://github.com/AmaiKinono/puni")
:bind
(:map puni-mode-map
("M-h" . puni-expand-region)
("M-H" . puni-contract-region)
([remap mark-sexp] . puni-mark-sexp-at-point)
([remap transpose-sexps] . puni-transpose)
("C-)" . puni-slurp-forward)
("C-(" . puni-slurp-backward)
("C-}" . puni-barf-forward)
("C-{" . puni-barf-backward))
:defer t
:config
(advice-add #'puni-kill-active-region :override
(defun AmaiKinono/puni-kill-active-region ()
"Kill active region.
When this will cause unbalanced state, ask the user to confirm,
unless `puni-confirm-when-delete-unbalanced-active-region' is
nil.
When `rectangle-mark-mode' is enabled, kill the marked
rectangular region instead."
(interactive)
(if (use-region-p)
(puni-kill-region)
;; Fall back to Emacs default behavior which is signaling an error or what
;; `kill-region-dwim' defines (since Emacs 31).
(call-interactively #'kill-region))))
:ensure t
:hook
(minibuffer-mode . puni-disable-puni-mode)
(text-mode . puni-disable-puni-mode)
:init
(puni-global-mode))
(use-package wakatime-mode
:vc (:url "https://github.com/wakatime/wakatime-mode")
:ensure t
:init
(defun gs-101/wakatime-api-key-from-auth ()
"Get the Wakatime API key from either auth-source or password-store."
(or (auth-source-pick-first-password :host "wakatime.com")
(secrets-get-attribute "Keepass" "Wakatime" "api-key")))
(defun gs-101/wakatime-enable-prompt ()
"Prompt if the user wants to enable wakatime tracking.
Better asked on startup with an init hook:
(add-hook \'after-init-hook #\'gs-101/wakatime-enable-prompt)"
;; Disable dialog box
(setq-local use-dialog-box nil)
(when (y-or-n-p "Enable wakatime tracking?")
(global-wakatime-mode)
(setopt wakatime-api-key (gs-101/wakatime-api-key-from-auth))))
(gs-101/wakatime-enable-prompt))
(provide 'gs-dev)