The contents of this repo are pure copy-paste from the awesome vim-go repo.
The only differences is that vim-gofmt strips most of the functionality, leaving only go-fmt and go-imports (along with the binary setup commands) to format your code
The reason is simply that I personally don't like having my vim editor act like a fully fledged IDE with all of its features.
So if you want more features, please check out vim-go
This plugin adds Go language support for Vim, with the following main features:
gofmt
goimports
vim-gofmt requires at least Vim 8.0.1453 or Neovim 0.3.1.
vim-gofmt follows the standard runtime path structure. Below are some helper lines for popular package managers:
- Vim 8 packages
git clone https://github.com/darrikonn/vim-gofmt.git ~/.vim/pack/plugins/start/vim-gofmt
- Pathogen
git clone https://github.com/darrikonn/vim-gofmt.git ~/.vim/bundle/vim-gofmt
- vim-plug
Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' }
- Vundle
Plugin 'darrikonn/vim-gofmt'
You will also need to install all the necessary binaries. vim-gofmt makes it easy
to install all of them by providing a command, :GoInstallBinaries
, which will
go install
all the required binaries.
vim-gofmt exposes four commands:
:GoFmt
- to format your code:GoImports
- to format/clean your imports:GoInstallBinaries
- to install the required binaries:GoUpdateBinaries
- to update the required binaries
The BSD 3-Clause License - see LICENSE
for more details