all repos — nixfiles @ 74c9fabdbea4cf1f9181fa5ad76a86b1bf6bccf1

System and user configuration, managed by nix and home-manager

emacs: enable format on save for TOML files
Alan Pearce alan@alanpearce.eu
Sat, 25 May 2024 12:45:25 +0200
commit

74c9fabdbea4cf1f9181fa5ad76a86b1bf6bccf1

parent

aa3b04c83e8fb05490feb37d8c1fe338b36437cc

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -1221,6 +1221,7 @@ '("shfmt"))             (setq apheleia-formatters
                   (append apheleia-formatters '((nixpkgs-fmt "nixpkgs-fmt")
                                                 (golines "golines")
+                                                (taplo "taplo" "format" "-")
                                                 (prettier-gotmpl
                                                  "prettier" "--stdin-filepath" filepath
                                                  "--parser=go-template" (apheleia-formatters-indent "--use-tabs" "--tab-width")))))
@@ -1229,7 +1230,8 @@ '(golines)                   (alist-get 'web-mode apheleia-mode-alist)
                   '(prettier-gotmpl))
             (setq apheleia-mode-alist (append apheleia-mode-alist '((nix-ts-mode . nixpkgs-fmt)
-                                                                    (nix-mode . nixpkgs-fmt))))
+                                                                    (nix-mode . nixpkgs-fmt)
+                                                                    (toml-ts-mode . taplo))))
             (add-hook 'apheleia-mode-hook #'turn-off-format-all-mode))
   :init (progn
           (apheleia-global-mode +1)))