summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2022-10-09 05:58:26 +0200
committerAlan Pearce2022-10-09 05:58:26 +0200
commit6b7692914ac786b910110872db59e762b40253f8 (patch)
treed670894a5fb2aa2772739af48ef76964866be742 /user
parent32bd166e364c68fb76c6748a3e5ee5d14982f02a (diff)
downloadnixfiles-6b7692914ac786b910110872db59e762b40253f8.tar.lz
nixfiles-6b7692914ac786b910110872db59e762b40253f8.tar.zst
nixfiles-6b7692914ac786b910110872db59e762b40253f8.zip
Emacs: improve nix indentation and make automatic
Diffstat (limited to 'user')
-rw-r--r--user/emacs/init.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 8036a4dc..accc8a5b 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -794,7 +794,11 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 ;;;; nix
 (with-eval-after-load 'nix-mode
-  (setq nix-indent-function #'nix-indent-line))
+  (setq nix-mode-use-smie t
+        nix-indent-function #'smie-indent-line)
+  (general-add-hook 'nix-mode-hook
+                    (lambda ()
+                      (add-hook 'before-save-hook #'nix-mode-format 0 'local))))
 
 (use-package nix-update
   :commands (nix-update-fetch))