summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs/lisp/kj-development.el
blob: aefba8564260d593db6a0e283260b7aa17906b1c (plain)
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
;;; -*- lexical-binding: t; -*-
(setq tab-stop-list (number-sequence 4 200 4))

(use-package eglot :elpaca nil
  :config
  (setq eglot-events-buffer-size 0))

(add-hook 'prog-mode-hook 'subword-mode)

;; Only used to get better eglot snippets.
(use-package yasnippet
  :config
  (add-to-list 'yas-snippet-dirs (expand-file-name "yasnippets" user-emacs-directory))
  (yas-global-mode))

(use-package tempel
  ;; Require trigger prefix before template name when completing.
  ;; :custom
  ;; (tempel-trigger-prefix "<")

  :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
         ("M-*" . tempel-insert))

  :init

  ;; Setup completion at point
  (defun tempel-setup-capf ()
    ;; Add the Tempel Capf to `completion-at-point-functions'.
    ;; `tempel-expand' only triggers on exact matches. Alternatively use
    ;; `tempel-complete' if you want to see all matches, but then you
    ;; should also configure `tempel-trigger-prefix', such that Tempel
    ;; does not trigger too often when you don't expect it. NOTE: We add
    ;; `tempel-expand' *before* the main programming mode Capf, such
    ;; that it will be tried first.
    (setq-local completion-at-point-functions
                (cons #'tempel-expand
                      completion-at-point-functions)))

  (add-hook 'conf-mode-hook 'tempel-setup-capf)
  (add-hook 'prog-mode-hook 'tempel-setup-capf)
  (add-hook 'text-mode-hook 'tempel-setup-capf)

  ;; Optionally make the Tempel templates available to Abbrev,
  ;; either locally or globally. `expand-abbrev' is bound to C-x '.
  ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
  ;; (global-tempel-abbrev-mode)
)

(use-package rustic
  :after eglot
  :bind (("C-c C-r C-s" . rustic-popup)
         ("C-c C-r C-n" . kj/rustic-nextest-all))
  :config
  (defun kj/rustic-nextest-all ()
    (interactive)
    (setq rustic-cargo-nextest-exec-command "nextest run --run-ignored all")
    (rustic-cargo-run-nextest))
  (setq
   ;; eglot seems to be the best option right now.
   rustic-lsp-client 'eglot
   rustic-format-on-save nil
   ;; Prevent automatic syntax checking, which was causing lags and stutters.
   ;; eglot-send-changes-idle-time (* 60 60)
   )
  :hook
  (rustic-mode . eglot-ensure)
  ;; Disable the annoying doc popups in the minibuffer.
  ;; (add-hook 'eglot-managed-mode-hook (lambda () (eldoc-mode -1)))
  )

(use-package markdown-mode
  :ensure t
  :mode ("README\\.md\\'" . gfm-mode)
  :init (setq markdown-command "multimarkdown"))

(use-package nix-mode
  :mode "\\.nix\\'")

(use-package ledger-mode
  :mode "\\.journal")
(use-package unobtrusive-magit-theme)

(use-package editorconfig
  :ensure t
  :config
  (editorconfig-mode 1)
  ;; Don't run on remote directories.
  (advice-add 'editorconfig-apply :before-until
              'kj/default-directory-remote-p))

(use-package clojure-mode)

;; Devicetree mode for keyboard configs.
(use-package dts-mode
  :mode "\\.keymap\\'")

(use-package yaml-mode
  :mode "\\.\(yml|yaml\)\\'")

;; (use-package ansi-color
;;     :hook (compilation-filter . ansi-color-compilation-filter))

(use-package diff-hl
  :config
  (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
  (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
  (global-diff-hl-mode))

(use-package graphviz-dot-mode
  :ensure t)

(use-package haskell-mode)
(use-package tidal
  :config
  (setq tidal-boot-script-path "~/projects/audio/BootTidal.hs"))

(use-package ess)

(use-package sly
  :custom
  (inferior-lisp-program "sbcl"))

(provide 'kj-development)