diff options
-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) |