diff options
author | Franck Cuny <franck@fcuny.net> | 2022-09-22 19:04:30 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-09-22 19:04:30 -0700 |
commit | aaaba8a655099ed3dbb90354d01917ac4c5f825d (patch) | |
tree | f2b9fa352e97400b90cb7c398ef4e5e6713b59fb | |
parent | ref(completion): add more packages for completion (diff) | |
download | emacs.d-aaaba8a655099ed3dbb90354d01917ac4c5f825d.tar.gz |
feat(lang/nix): format the buffer on save
Delegate the formatting of the buffer to the LSP server. Change-Id: Iabb7b838fba71dffcff5dd272aa5895801d6db3c
-rw-r--r-- | emacs/custom/my-lang-nix.el | 5 |
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) |