标签:
开始决定丢弃鼠标,所以准备用vim了。
那么在vim里面如何搭建golang环境呢?
git盛行之下,搭建vim环境是如此简单。
而且vim搭建好了之后,基本上跟IDE没有差别。
高亮、自动补全、自动格式化、查看定义跳转、语法检测等等等等, 简直是不要不要的:
gocode
gofmt
on save, which keeps cursor position and doesn‘t break your undo history:GoDef
:GoDoc
inside Vim or open it in browser:GoImport
or plug it into autosave:GoBuild
, install it with :GoInstall
or test them with :GoTest
(also supports running single tests via :GoTestFunc
):GoRun
GOPATH
detection based on the directory structure (i.e. gb
projects, godep
vendored projects)GOPATH
with :GoPath
:GoCoverage
gometalinter
with :GoMetaLinter
, which invokes all possible linters (golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors:GoLint
:GoVet
to catch static errors:GoImplements
, :GoCallees
, and :GoReferrers
:GoRename
:GoErrCheck
ultisnips
or neosnippet
:GoPlay
gotags
a function
or inner function
list.:GoRun
and other go commands in their own new terminal. (beta):GoAlternate
安装起来也非常方便,只要一下三行代码:
#下载安装
git clone git@github.com:farazdagi/vim-go-ide.git ~/.vim_go_runtime
sh ~/.vim_go_runtime/bin/install
#运行
vim -u ~/.vimrc.go
PS:
a)这里要求vim 要开启lua :
brew install vim --with-lua --override-system-vim
b)如果需要类解析,需要转ctag
原文:http://farazdagi.com/blog/2015/vim-as-golang-ide/
效果如下:
标签:
原文地址:http://www.cnblogs.com/zhangqingping/p/5215071.html