Test environment: Ubuntu 14.04 version Kylin
Vim itself does not have golang syntax highlighting
Solution:
In the/usr/share/vim/vim74/
There are so few folders: syntax, Ftplugin, indent, compiler, etc.,
We see syntax can see there are gcc.vim and other grammar files, but no go.vim, fortunately we can download from the source code
Http://www.golangtc.com/download Download go1.3.3.src.tar.gzgo1.3.3 (source only), unzip,
Copy the syntax, Ftplugin, indent, compiler files in the go/misc/vim/of the download directory to the go.vim corresponding directory, The Ftdetect folder includes files that are copied to Vim74 .
Additional settings are as follows:
$/usr/share/vim$ Vim VIMRC
Syntax on
22
Set number "Displays line numbers
Set Cursorline "highlight when moving forward
Set tabstop=4 "Tab key width
26
27 "Unified Indent is 4
Softtabstop=4 Set
Set shiftwidth=4
Complete.
Syntax highlighting for go in vim