diff options
author | Alan Pearce | 2024-06-18 20:29:16 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-18 20:29:16 +0200 |
commit | 116b5525d76168073e657cf3fcf9ec3885dde229 (patch) | |
tree | 796abc8645941b8424358003ec496c36596b5ea9 | |
parent | e9d62e56f73a1ecc772073ab3ce2705abf153028 (diff) | |
download | nixfiles-116b5525d76168073e657cf3fcf9ec3885dde229.tar.lz nixfiles-116b5525d76168073e657cf3fcf9ec3885dde229.tar.zst nixfiles-116b5525d76168073e657cf3fcf9ec3885dde229.zip |
emacs: start eglot in templ files
-rw-r--r-- | user/emacs/init.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el index 6b30ac70..afef3d1f 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -791,6 +791,7 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve (setq-default go-ts-mode-indent-offset 2) (use-package templ-ts-mode + :gfhook #'eglot-format-before-save-mode :defer t :config (progn (setq-default go-ts-mode-indent-offset 2))) @@ -1093,6 +1094,13 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve :commands (consult-lsp-symbols consult-lsp-diagnostics)) +(define-minor-mode eglot-format-before-save-mode + "Whether to ask the LSP to format the buffer before saving" + :init-val nil + (if eglot-format-before-save-mode + (add-hook 'before-save-hook #'eglot-format-buffer nil 'local) + (remove-hook 'before-save-hook #'eglot-format-buffer 'local))) + (use-package eglot :defer 3 :general (:states 'normal :keymaps 'eglot-mode-map @@ -1107,6 +1115,7 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve nim-mode-hook html-mode-hook nix-mode-hook + templ-ts-mode-hook toml-ts-mode-hook haskell-mode-hook) #'eglot-ensure) |