summary refs log tree commit diff
path: root/emacs/custom
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/custom')
-rw-r--r--emacs/custom/my-lang-nix.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/emacs/custom/my-lang-nix.el b/emacs/custom/my-lang-nix.el
index 9de5c50..7d197e2 100644
--- a/emacs/custom/my-lang-nix.el
+++ b/emacs/custom/my-lang-nix.el
@@ -14,6 +14,11 @@
                   :major-modes '(nix-mode)
                   :server-id 'nix))
 
+(defun my/lsp-nix-install-save-hooks ()
+  "Set up before-save hooks to format buffer."
+  (add-hook 'before-save-hook #'lsp-format-buffer t t))
+
+(add-hook 'nix-mode-hook #'my/lsp-nix-install-save-hooks)
 (add-hook 'nix-mode-hook #'lsp-deferred)
 
 (provide 'my-lang-nix)