summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2024-04-29 08:06:43 +0200
committerAlan Pearce2024-04-29 08:06:43 +0200
commite0ee29efdea8c63d65cd81ba9a767320e95ee8c1 (patch)
treee24ee589bbebb83212068f9eb62e87aafd449f4a /user/emacs
parent3934e2fc7583230336ff669fa2433f9e3069ada6 (diff)
downloadnixfiles-e0ee29efdea8c63d65cd81ba9a767320e95ee8c1.tar.lz
nixfiles-e0ee29efdea8c63d65cd81ba9a767320e95ee8c1.tar.zst
nixfiles-e0ee29efdea8c63d65cd81ba9a767320e95ee8c1.zip
emacs: use "base" mode hooks where there are ts and non-ts modes
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el26
1 files changed, 18 insertions, 8 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 75b4b2c0..4ee43171 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -438,9 +438,9 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :after evil
   :defer 2
   :config (progn
-            (add-hook 'js-mode-hook (lambda ()
-                                      (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/")
-                                      (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist)))
+            (add-hook 'js-base-mode-hook (lambda ()
+                                           (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/")
+                                           (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist)))
             (add-hook 'emacs-lisp-mode-hook (lambda ()
                                               (push '(?` . ("`" . "'")) evil-surround-pairs-alist)))
             (global-evil-surround-mode +1)))
@@ -450,7 +450,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :after evil-surround
   :ghook ('LaTex-mode-hook #'embrace-LaTeX-mode-hook)
   :ghook ('org-mode-hook #'embrace-org-mode-hook)
-  :ghook ('ruby-mode-hook #'embrace-ruby-mode-hook)
+  :ghook ('ruby-base-mode-hook #'embrace-ruby-mode-hook)
   :ghook ('emacs-lisp-mode-hook #'embrace-emacs-lisp-mode-hook)
   :config (progn
             (setq evil-embrace-show-help-p nil)
@@ -742,7 +742,9 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 
 ;;;; tree-sitter
 (use-package treesit-auto
-  :config (global-treesit-auto-mode))
+  :config (progn
+            (global-treesit-auto-mode)
+            (treesit-auto-add-to-auto-mode-alist)))
 
 ;;;; golang
 (setq go-mode-indent-offset tab-width
@@ -1009,6 +1011,10 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :config (progn
             (setq treemacs-no-png-images t)))
 
+(setq typescript-ts-mode-hook typescript-ts-mode
+      dockerfile-ts-mode-hook dockerfile-ts-mode
+      yaml-ts-mode-hook yaml-mode-hook
+      go-ts-mode-hook go-mode-hook)
 (use-package eglot
   :defer 3
   :general (:states 'normal :keymaps 'eglot-mode-map
@@ -1018,8 +1024,8 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :ghook ('(typescript-mode-hook
             dockerfile-mode-hook
             yaml-mode-hook
-            js-mode-hook
-            css-mode-hook
+            js-base-mode-hook
+            css-base-mode-hook
             go-mode-hook
             lua-mode-hook
             nim-mode-hook
@@ -1059,7 +1065,11 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 
 (use-package add-node-modules-path
   :config (setq add-node-modules-max-depth 6)
-  :ghook ('(feature-mode-hook json-ts-mode-hook typescript-ts-mode-hook) #'add-node-modules-path))
+  :ghook ('(feature-mode-hook
+            js-base-mode-hook
+            json-ts-mode-hook
+            typescript-ts-mode-hook)
+          #'add-node-modules-path))
 
 ;;;; Reformat on save