Enable gofumpt

Sat, 24 Apr 2021 18:09:46 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 24 Apr 2021 18:09:46 -0500
changeset 896
3c3d12500dd3
parent 895
5dc2a52cb495
child 897
760d4f0ca87b

Enable gofumpt

.vimrc file | annotate | diff | comparison | revisions
--- a/.vimrc
+++ b/.vimrc
@@ -349,12 +349,17 @@ augroup vim-lsp
       \ })
   endif
 
+  " GO111MODULE=off go get -u golang.org/x/tools/gopls mvdan.cc/gofumpt
   if executable('gopls')
     autocmd User lsp_setup call lsp#register_server({
       \ 'name': 'gopls',
       \ 'cmd': {server_info->['gopls']},
       \ 'whitelist': ['go'],
+      \ 'workspace_config': {'gopls':
+        \ {'formatting.gofumpt': executable('gofumpt') ? v:true : v:false}
+      \ },
       \})
+    autocmd BufWritePre *.go LspDocumentFormatSync
   endif
 
   if executable('nimlsp')

mercurial