emacs: use "base" mode hooks where there are ts and non-ts modes
Alan Pearce alan@alanpearce.eu
Mon, 29 Apr 2024 08:06:43 +0200
1 files changed, 18 insertions(+), 8 deletions(-)
jump to
M user/emacs/init.el → user/emacs/init.el
@@ -438,9 +438,9 @@ (use-package evil-surround :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 @@ (use-package evil-embrace :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 @@ ;;; Major modes ;;;; 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 @@ :defer t :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-t" #'xref-pop-marker-stack) :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 @@ ;; the project. This will allows emacs to find their executables. (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