diff options
author | Alan Pearce | 2024-05-10 11:06:21 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-10 17:58:23 +0200 |
commit | 9a7e1466e64eb706e11eeecef310983dfed88c12 (patch) | |
tree | 0ba02eba30b49cedd42ff6582729a0c6163bd6ae /user | |
parent | 1e7e46c99bbd75dafb7f7d1d0ece222a86959d75 (diff) | |
download | nixfiles-9a7e1466e64eb706e11eeecef310983dfed88c12.tar.lz nixfiles-9a7e1466e64eb706e11eeecef310983dfed88c12.tar.zst nixfiles-9a7e1466e64eb706e11eeecef310983dfed88c12.zip |
enable auto-formatting of go-template files
Diffstat (limited to 'user')
-rw-r--r-- | user/emacs/init.el | 9 | ||||
-rw-r--r-- | user/settings/development/golang.nix | 1 |
2 files changed, 8 insertions, 2 deletions
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))) diff --git a/user/settings/development/golang.nix b/user/settings/development/golang.nix index e5cd9199..f2ddc088 100644 --- a/user/settings/development/golang.nix +++ b/user/settings/development/golang.nix @@ -6,6 +6,7 @@ golines golangci-lint golangci-lint-langserver + nodePackages.prettier-plugin-go-template ]; programs.emacs.extraPackages = epkgs: (with epkgs; [ go-eldoc |