From e0ee29efdea8c63d65cd81ba9a767320e95ee8c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2024 08:06:43 +0200 Subject: emacs: use "base" mode hooks where there are ts and non-ts modes --- user/emacs/init.el | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'user/emacs') 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 -- cgit 1.4.1