Created
April 13, 2020 14:21
-
-
Save tbrisbout/a91ac3419440cde40c5f54dc32c94427 to your computer and use it in GitHub Desktop.
Gofmt on save in vim without plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! CustomGoFmt() | |
let file = expand('%') | |
silent execute "!gofmt -w " . file | |
edit! | |
set filetype = go | |
endfunction | |
command! CustomGoFmt call CustomGoFmt() | |
augroup go_autocmd | |
autocmd BufWritePost *.go CustomGoFmt | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment