all repos — nixfiles @ 8bb999782312ec263c0640dee33a87d97c448351

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

golang: support editing templ files
Alan Pearce alan@alanpearce.eu
Sun, 16 Jun 2024 17:53:50 +0200
commit

8bb999782312ec263c0640dee33a87d97c448351

parent

21bf21d01da7d78994d4339804374c0a62ea44fd

2 files changed, 10 insertions(+), 1 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -789,6 +789,12 @@ ;;;; golang (with-eval-after-load 'project
   (add-to-list 'project-vc-extra-root-markers "go.mod"))
 
+(setq-default go-ts-mode-indent-offset 2)
+(use-package templ-ts-mode
+  :defer t
+  :config (progn
+            (setq-default go-ts-mode-indent-offset 2)))
+
 ;;;; nim
 (use-package nim-mode
   :defer t
@@ -1048,7 +1054,9 @@ (use-package editorconfig   :defer 2
   :config (progn
             (editorconfig-mode +1)
-            (setq editorconfig-lisp-use-default-indent t)))
+            (setq editorconfig-lisp-use-default-indent t)
+            (setf (alist-get 'templ-ts-mode editorconfig-indentation-alist)
+                  'go-ts-mode-indent-offset)))
 
 (setq-default ispell-dictionary "en_GB-ise-w_accents")
 (setq ispell-extra-args '("--sug-mode=ultra" "--camel-case"))
M user/settings/development/golang.nixuser/settings/development/golang.nix
@@ -15,6 +15,7 @@ ];   programs.emacs.extraPackages = epkgs: (with epkgs; [
     go-eldoc
     go-tag
+    templ-ts-mode
   ]);
   programs.neovim.plugins = with pkgs.vimPlugins; [
     coc-go