把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,当任务比较多 ...
随机推荐
- asp.net静态变量的生命周期和线程安全
void Application_Start开始 void Application_End结束的,本来这就是对的 今天要做一个全局的应用,想确认一下,在网上一找,我的天,说什么的都有 大概分三种 1. ...
- gdb汇编调试
GDB调试汇编堆栈分析 代码: sudo apt-get install libc6-dev-i386命令安装所需库 进入之后先在main函数处设置一个断点,再run一下,使用disassemble指 ...
- MacBook Pro/Air 下使用 linux ubuntu 系统 波浪号“~”变成其他 符号 的完美解决办法
打开终端,输入: sudo su - > /sys/module/hid_apple/parameters/iso_layout sudo su -需要root权限,所以使用前请注意已下载roo ...
- 数据库的NULL值讨论
有许多关于数据库设计中NULL的讨论,我个人的设计习惯是,不使用NULL值. 我所设计所有表都是Not Null的字段的,尤其是我主要做数据仓库的表设计.刚开始使用数据库时,就栽了一次.一个Group ...
- js闭包,匿名函数概念
var functionName = function(arg){ //函数体 }; 匿名函数:创建一个函数,并将它赋值给一个变量,这种情况下创建的函数叫做匿名函数,因为function关键字后面没有 ...
- ppt 数组课后作业
任务要求:随机生成10个数,填充一个数组,然后用消息框显示数组内容,接着计算数组元素的和,将结果也显示在消息框中. 设计思路:建一个数组,在for语句中将随机数存入数组中,然后每生成一个数就进行相加, ...
- ubuntu软件推荐
本文推荐的ubuntu工具均为笔者亲用.原则:在精不在多. 0.万能类 笔者崇尚[极简主义],常用的工具如果有网页版的就尽量不用单独的client.如网页版微信. 1.系统类 截图:Deepin-sc ...
- lnmp
参照http://www.osyunwei.com/archives/8867.html,略有改动 一 .系统约定 软件源代码包存放位置:/usr/local/src 源码包编译安装位置:/usr/l ...
- C#中string在内存中是如何表示的
不知道你是否有过和我一样的疑问,不同编码的字符串是如何存储在运行时的内存中的呢,计算机在操作string类型的对象时,如何知道这个string是什么编码呢?和文本文件那样有类似BOM的东东在strin ...
- codeforces 742D Arpa's weak amphitheater and Mehrdad's valuable Hoses ——(01背包变形)
题意:给你若干个集合,每个集合内的物品要么选任意一个,要么所有都选,求最后在背包能容纳的范围下最大的价值. 分析:对于每个并查集,从上到下滚动维护即可,其实就是一个01背包= =. 代码如下: #in ...