This is a creation in Article, where the information may have evolved or changed.
Https://code.google.com/p/go/source/browse/misc/vim/readme.txt
If you encounter local compilation problems, you can use Http://gobuild.io to fix
Basic tool Installation
- Installing Goimports
go get github.com/bradfitz/goimports
- Installing Gocode
go get github.com/nsf/gocode
- Installing Godef
go get code.google.com/p/rog-go/exp/cmd/godef
- Install vim (this does not speak, requires a high version)
Vundle Installation and Configuration
Install Vundle, which is a plugin for managing vim plugins. Very powerful.
Installation method I copied it directly from the GitHub page.
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
Then modify the VIMRC
Set nocompatible "be improvedfiletype off " Required!set rtp+=~/.vim/bundle/vundle/call VUNDLE#RC () "Let Vundle Manage Vundle "required! Bundle ' Gmarik/vundle ' bundle ' Cespare/vim-golang ' bundle ' blackrush/vim-gocode ' "bundle ' valloric/youcompleteme '" ... Other Pluginsyntax onfiletype plugin indent on "required!" " Brief Help ": Bundlelist -List configured bundles": Bundleinstall (!) -Install (update) Bundles ": Bundlesearch (!) Foo-search (or refresh cache first) for Foo": Bundleclean (!) -Confirm (or auto-approve) removal of unused bundles "" see:h vundle for more details or wiki for FAQ "note:comments aft Er Bundle commands is not allowed. " Set Omnifunc=syntaxcomplete#complete set Completeopt=longest,menuautocmd bufwritepre *.go:fmtset showcmdset Ruler "Enable Backspaceset Backspace=indent,eol,startset Nuset mouse=
Turn on vim, execute in command mode:BunduleInstall
If you find that automatic completion is not so, one more step.
CD $GOPATH/src/github.com/nsf/gocode && vim/update.sh
The following ignore, verified, will conflict with other plugins
Install YCM (primarily youcompleteme required) CD ~/.vim/bundle/youcompleteme &&./install.sh
Enhanced Continuation (Installation snippets)
Reference source Https://github.com/garbas/vim-snipmate
VIMRC New
"Snipmatebundle" Marcweber/vim-addon-mw-utils "bundle" Tomtom/tlib_vim "bundle" Garbas/vim-snipmate "" Optional: Bundle "Honza/vim-snippets"
Open vim, run it again:BundleInstall
Put the inside of the memory is OK..vim/bundle/vim-snippets/snippets/go.snippets