VIM编辑器下go语法高亮显示

Go in Vim

The standard Go distribution includes a Go syntax file for Vim in go/misc/vim/.

Installation Instructions

Place $GOROOT/misc/vim/syntax/go.vim in ~/.vim/syntax/ and put the following in ~/.vim/ftdetect/go.vim:

在go的安装目录里有/misc/vim/syntax 他 /misc/vim/ftdetect 两个目录,将里面的文件复制到~/.vim/相应的目录里即可。

au BufRead,BufNewFile *.go set filetype=go

Extras and Alternative Files

An alternative indent file for Vim by Alecs King can be found here.

Autocompletion

The gocode daemon by nsf includes a vim script to do autocompletion.

Other

See the vim-golang repo in Github for alternative syntax highlight, auto-indentation, gofmt and other useful scripts and plugins.

And this reddit post for various ways to integrate gofmt with vim.

转自:http://go-lang.cat-v.org/text-editors/vim/

vim设置完以后,需要重新登录ssh终端才可以看到加亮效果。

如果使用ssh远程登录软件的话,默认是不会加亮显示的.这个时候只需要设置一下就可以了.参考:SecureCRT远程ssh使VIM语法加亮