This is a creation in Article, where the information may have evolved or changed.
In most cases, using vim to write Golang code requires syntax highlighting and automatic format. To do this, add a plugin that supports the Golang syntax to the VIM editor, and the plug-in configuration method is as follows:
1, download vim plugin management tool, if you have git, you can use Git clone directly
Https://github.com/tpope/vim-pathogen
2, in the establishment of folder ~/.vim
mkdir ~/.vim
3, copy Vim-pathogen under the AutoLoad folder to ~/.vim under:
4, under the ~/.vim set up the bundle folder, used to store vim plug-ins, file directory structure:
[Root@bogon. vim]# tree-l 1 *
AutoLoad
└──pathogen.vim
Bundle
├──nerdtree
├──vim-go
└──vundle.vim
5, CD ~/.vim/bundle to bundle under
Execute git clone https://github.com/fatih/vim-go install vim-go plugin
6. Configure your own VIMRC file, Vim ~/.VIMRC, add:
Call Pathogen#infect ()
Syntax on
FileType plugin indent on
Now browse the Golang code, there is syntax highlighting support and save the time of automatic FMT
7, installs the guru, realizes uses the GD command to jump to the function definition:
First create the/golang.org/x folder under the Gopath path and then execute it under this folder:
git clone https://github.com/golang/tools
Execute after download: Go install Golang.org/x/tools/cmd/guru
To this vim has the vim-go plug-in and guru function jump support, writing Golang code more convenient, development is faster.