Just the parts of vim-go that run goimports on save.
This will cause saving to blow away the redo list. Don't expect to be able to undo a bunch of times, save, and redo back to where you started.
- If you wish to use goimports, install it.
- Clone this repository and copy its contents into
~/.vim
. That should put files in~/.vim/{ftdetect,plugin,autoload/go}
. - If goimports is slow for you (likely if you don't have an SSD), you may
want to change
go#fmt#Format(1)
togo#fmt#Format(-1)
(change 1 to -1) inplugin/go.vim
. That will gofmt instead.
I created this by copying autoload/go/fmt.vim
, autoload/go/tool.vim
, and
ftdetect/gofiletype.vim
, and then taking the functions from IsWin through
GetBinPath (in other words, the latter and all its dependencies) from
plugin/go.vim
. At the end of that file, I added just the if statement
that installs the autocmd to call go#fmt#Format and changed the argument
from -1 to 1.
This may actually have been easier than figuring out how to turn off all the things in vim-go that I don't want (yet!)