5

Vim Golang 开发环境: vim-go

 1 year ago
source link: https://fann.im/blog/2014/07/23/vim-golang-environment/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Vim Golang 开发环境: vim-go

Jul 23, 2014

安装 Golang 并设置 $GOPATH:

export GOPATH="$HOME"
export PATH="$PATH:$GOPATH/bin"

Golang 官方提供了 Vim 开发工具 $GOROOT/misc/vim,但功能很弱,所以有很多第三方的辅助开发应用:

  1. gocode 自动代码补全
  2. godef 函数定义跳转,快捷键 gd
  3. goimports 自动 import 包管理
  4. gotags 展示当前代码里函数列表,配合 tagbar 使用

这几个是独立的应用,配套相应的 Vim 插件,单独安装很是繁琐。而 vim-go 是一整套的 Golang Vim 开发配置,安装插件后通过 GoInstallBinaries 安装 gocode, godef, goimports, gotags, golint, oracle, errcheck 以及相应的 Vim 插件、配色、代码块,非常方便。

Plugin 'fatih/vim-go' 安装,默认代码补全引擎是 Ultisnips,修改为 neosnippet let g:go_snippet_engine = "neosnippet"

我的 vimrc.

Was this page helpful?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK