這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
2013-12-17 wcdj
之前總結過在subl中使用GoLang,《GoLang及Sublime Text 2之Mac OS X 10.8.4開發環境安裝 》。其實GoLang的安裝包中已經包含了支援Vim的編寫外掛程式,配置方法很簡單,如下文所述。
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
:
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 foralternative syntax highlight, auto-indentation, gofmt and other useful scriptsand plugins.
And this reddit post for various ways to integrate gofmt
with vim.
參考:
[1] http://go-lang.cat-v.org/text-editors/vim/