From 9a7e1466e64eb706e11eeecef310983dfed88c12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 May 2024 11:06:21 +0200 Subject: enable auto-formatting of go-template files --- user/emacs/init.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'user/emacs') diff --git a/user/emacs/init.el b/user/emacs/init.el index 09c67d18..9f035ffa 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -1109,11 +1109,16 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve :config (progn (setf (alist-get 'shfmt apheleia-formatters) '("shfmt")) - (setq apheleia-formatters (append apheleia-formatters '((nixpkgs-fmt "nixpkgs-fmt")))) + (setq apheleia-formatters + (append apheleia-formatters '((nixpkgs-fmt "nixpkgs-fmt") + (prettier-gotmpl + ("prettier" "--stdin-filepath" filepath + "--parser=go-template" (apheleia-formatters-js-indent "--use-tabs" "--tab-width")))))) (setf (alist-get 'go-ts-mode apheleia-mode-alist) '(goimports)) (setq apheleia-mode-alist (append apheleia-mode-alist '((nix-ts-mode . nixpkgs-fmt) - (nix-mode . nixpkgs-fmt)))) + (nix-mode . nixpkgs-fmt) + (go-ts-mode . prettier-gotmpl)))) (add-hook 'apheleia-mode-hook #'turn-off-format-all-mode)) :init (progn (apheleia-global-mode +1))) -- cgit 1.4.1