把vim当做golang的IDE
开始决定丢弃鼠标,所以准备用vim了。
那么在vim里面如何搭建golang环境呢?
git盛行之下,搭建vim环境是如此简单。
而且vim搭建好了之后,基本上跟IDE没有差别。
高亮、自动补全、自动格式化、查看定义跳转、语法检测等等等等, 简直是不要不要的:
- Improved Syntax highlighting with items such as Functions, Operators, Methods.
- Auto completion support via
gocode - Better
gofmton save, which keeps cursor position and doesn't break your undo history - Go to symbol/declaration with
:GoDef - Look up documentation with
:GoDocinside Vim or open it in browser - Automatically import packages via
:GoImportor plug it into autosave - Compile your package with
:GoBuild, install it with:GoInstallor test them with:GoTest(also supports running single tests via:GoTestFunc) - Quickly execute your current file/files with
:GoRun - Automatic
GOPATHdetection based on the directory structure (i.e.gbprojects,godepvendored projects) - Change or display
GOPATHwith:GoPath - Create a coverage profile and display annotated source code in browser to see which functions are covered with
:GoCoverage - Call
gometalinterwith:GoMetaLinter, which invokes all possible linters (golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors - Lint your code with
:GoLint - Run your code through
:GoVetto catch static errors - Advanced source analysis tools utilizing oracle, such as
:GoImplements,:GoCallees, and:GoReferrers - Precise type-safe renaming of identifiers with
:GoRename - List all source files and dependencies
- Unchecked error checking with
:GoErrCheck - Integrated and improved snippets, supporting
ultisnipsorneosnippet - Share your current code to play.golang.org with
:GoPlay - On-the-fly type information about the word under the cursor. Plug it into your custom vim function.
- Go asm formatting on save
- Tagbar support to show tags of the source code in a sidebar with
gotags - Custom vim text objects such as
a functionorinner functionlist. - A async launcher for the go command is implemented for Neovim, fully async building and testing (beta).
- Integrated with the Neovim terminal, launch
:GoRunand other go commands in their own new terminal. (beta) - Alternate between implementation and test code with
: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
--------------------
2016-10-20补充
如果把go升级到go1.7,这里的函数 auto-complete 会显示PANIC不能显示任何的系统库对应的函数和自定义的函数
这里需要做一件事情,可以恢复
ps aux | grep gocode #存在就干掉
killall gocode #重启
gocode
或者采用以下方式
gocode close && go get -u github.com/nsf/gocode
参考这里:https://github.com/fatih/vim-go/issues/1015
---------------------
原文:http://farazdagi.com/blog/2015/vim-as-golang-ide/
效果如下:

把vim当做golang的IDE的更多相关文章
- golang笔记——IDE
可选方案有 Lite IDE\GoSublime\Visual Studio Code\Goclipse\Vim 1.Lite IDE 这是国人开发的开源且跨平台的 golang 专属IDE,也算是目 ...
- 【转】手把手教你把Vim改装成一个IDE编程环境(图文)
手把手教你把Vim改装成一个IDE编程环境(图文) By: 吴垠 Date: 2007-09-07 Version: 0.5 Email: lazy.fox.wu#gmail.com Homepage ...
- Ubuntu下将vim配置为Python IDE(转)
工欲善其事,必先利其器. 配置好了Django的环境,该把vim好好配置一下当做python的IDE来用. 在Windows下用惯了各种现成的工具,转到Linux下,一下没了头绪……好歹google出 ...
- Vim配置及说明——IDE编程环境
Vim配置及说明——IDE编程环境 Vim配置及说明——IDE编程环境 1.基本及字体 2.插件管理 3.主题风格 4.窗口设置 5.目录树导航 6.标签导航 7.taglist 8.多文档编辑 9. ...
- golang学习笔记11 golang要用jetbrain的golang这个IDE工具开发才好
golang学习笔记11 golang要用jetbrain的golang这个IDE工具开发才好 jetbrain家的全套ide都很好用,一定要dark背景风格才装B 从File-->s ...
- Use Vim as a Python IDE
Use Vim as a Python IDE I love vim and often use it to write Python code. Here are some useful plugi ...
- Vim改装成一个IDE编程环境
1 写在前面 Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Linux牛人, 黑客之类的也都不用IDE. 但是对我等从Windows平台转移过来的Coder来说, 一个 ...
- 04-手把手教你把Vim改装成一个IDE编程环境(图文)
Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Linux牛人, 黑客之类的也都不用IDE. 但是对我等从Windows平台转移过来的Coder来说, 一个好用的IDE是何等的重 ...
- Ubuntu16.04 IDE: 用Vim逐步打造一个IDE
目前打造完成的IDE主要有: terminator+Bundle+NERDtree+YCF(youcompleteme)+UltiSnips+新创建文件自动补充注释和作者,版权信息等 1,当任务比较多 ...
随机推荐
- jq 版的tab切换
ta切换是在前端中非常常见的一种效果,网上的效果很多.但是我觉得下面这种方法最好,把tab效果封装成一个函数 tabs,这个函数要配合jq使用. var tabs = function (tab, c ...
- JS数组push会覆盖前面的数据问题
这是一个作用域和重新赋值的问题. 检查声明数组所在位置,特别在是多层嵌套中,检查是否在内层循环结束时 跳到外层循环就重新将 数组 赋值为空.
- swift 键盘属性与事件
1.键盘的类型 textField1.keyboardType = UIKeyboardType.default //系统默认的虚拟键盘 textField1.keyboardType = UIKey ...
- java编码解码乱码问题
服务器设值(中文)到界面使用了两次编码: String pageJson=URLEncoder.encode(URLEncoder.encode(str,"GBK"), " ...
- teeChart 修改注册表实现无试用到期提示
teechart在注册表的跟目录为HKEY_CLASSES_ROOT\CLSID,以下的子目录会根据版本的不同发生改变,但是最底级的目录是TypeLib(例如[HKEY_CLASSES_ROOT\CL ...
- 初识Promise
Promise对象 曾经用seajs开发后台管理的时候,矫情的PHPER非要JS内联到HTML文件中,方便他调用内容,还指定了jQueryFileUpload作为上传插件. 当时看到jQueryFil ...
- hashMap的get()方法,错用并发造成cpu和负载高
一次线上问题的解决 线上发现服务cpu使用达到98%,负载高达200多,64核心cpu,下面介绍解决过程: 1.top命令查出占用cpu高的进程pid 2.使用jstack -l pid >du ...
- AIX 环境下遇到Device Busy问题
IBM AIX v5.3操作系统环境下在对网络或网卡进行操作过程中经常遇到"Device Busy"而终止操作例如:#rmdev -l ent1遇到如下返回信息Method err ...
- Jmeter循环控制
Jmeter循环控制 很多时候,在做接口测试时,系统处理请求需要一段时间后才能返回信息,而下一个请求需要系统返回信息后才能进行处理,这时候通常需要加入循环控制器,来验证系统是否是否返回了处理后的信息. ...
- Java实现emf图片自己留转png(jpg)图片字节流
private byte[] emfToPng(InputStream is){ // InputStream inputStream=null; byte[] by=null; EMFInputSt ...