From a02a4f2765a3916ba8242d9919244dc12624e5b7 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 8 Aug 2024 01:04:31 +0200 Subject: Autoformat Go and Templ code on save --- .exrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.exrc b/.exrc index 5682015..c1f065a 100644 --- a/.exrc +++ b/.exrc @@ -1 +1,10 @@ +function s:SaveExcursion(cmd) + let l:win = winsaveview() + execute '%!' .. a:cmd + call winrestview(l:win) +endfunction + +autocmd BufWritePre *.go call s:SaveExcursion('gofmt -s') +autocmd BufWritePre *.templ call s:SaveExcursion('templ fmt') + let g:netrw_list_hide .= ',.*_templ.go$' -- cgit v1.2.3