diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/gofumpt.vim | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index c6764daf..eb7d7f53 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -246,6 +246,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with go fmt.', \ }, +\ 'gofumpt': { +\ 'function': 'ale#fixers#gofumpt#Fix', +\ 'suggested_filetypes': ['go'], +\ 'description': 'Fix Go files with gofumpt, a stricter go fmt.', +\ }, \ 'goimports': { \ 'function': 'ale#fixers#goimports#Fix', \ 'suggested_filetypes': ['go'], diff --git a/autoload/ale/fixers/gofumpt.vim b/autoload/ale/fixers/gofumpt.vim new file mode 100644 index 00000000..99753209 --- /dev/null +++ b/autoload/ale/fixers/gofumpt.vim @@ -0,0 +1,17 @@ +" Author: David Houston <houstdav000> +" Description: A stricter gofmt implementation. + +call ale#Set('go_gofumpt_executable', 'gofumpt') +call ale#Set('go_gofumpt_options', '') + +function! ale#fixers#gofumpt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_gofumpt_executable') + let l:options = ale#Var(a:buffer, 'go_gofumpt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ale#Pad(l:options) + \ . ' -w -- %t', + \ 'read_temporary_file': 1, + \} +endfunction |