开始决定丢弃鼠标,所以准备用vim了。

那么在vim里面如何搭建golang环境呢?

git盛行之下,搭建vim环境是如此简单。

而且vim搭建好了之后,基本上跟IDE没有差别。

高亮、自动补全、自动格式化、查看定义跳转、语法检测等等等等, 简直是不要不要的:

  • Improved Syntax highlighting with items such as Functions, Operators, Methods.
  • Auto completion support via gocode
  • Better gofmt on save, which keeps cursor position and doesn't break your undo history
  • Go to symbol/declaration with :GoDef
  • Look up documentation with :GoDoc inside Vim or open it in browser
  • Automatically import packages via :GoImport or plug it into autosave
  • Compile your package with :GoBuild, install it with :GoInstall or test them with :GoTest (also supports running single tests via :GoTestFunc)
  • Quickly execute your current file/files with :GoRun
  • Automatic GOPATH detection based on the directory structure (i.e. gb projects, godep vendored projects)
  • Change or display GOPATH with :GoPath
  • Create a coverage profile and display annotated source code in browser to see which functions are covered with:GoCoverage
  • Call gometalinter with :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 :GoVet to 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 ultisnips or neosnippet
  • 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 function or inner function list.
  • A async launcher for the go command is implemented for Neovim, fully async building and testing (beta).
  • Integrated with the Neovim terminal, launch :GoRun and 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的更多相关文章

  1. golang笔记——IDE

    可选方案有 Lite IDE\GoSublime\Visual Studio Code\Goclipse\Vim 1.Lite IDE 这是国人开发的开源且跨平台的 golang 专属IDE,也算是目 ...

  2. 【转】手把手教你把Vim改装成一个IDE编程环境(图文)

    手把手教你把Vim改装成一个IDE编程环境(图文) By: 吴垠 Date: 2007-09-07 Version: 0.5 Email: lazy.fox.wu#gmail.com Homepage ...

  3. Ubuntu下将vim配置为Python IDE(转)

    工欲善其事,必先利其器. 配置好了Django的环境,该把vim好好配置一下当做python的IDE来用. 在Windows下用惯了各种现成的工具,转到Linux下,一下没了头绪……好歹google出 ...

  4. Vim配置及说明——IDE编程环境

    Vim配置及说明——IDE编程环境 Vim配置及说明——IDE编程环境 1.基本及字体 2.插件管理 3.主题风格 4.窗口设置 5.目录树导航 6.标签导航 7.taglist 8.多文档编辑 9. ...

  5. golang学习笔记11 golang要用jetbrain的golang这个IDE工具开发才好

    golang学习笔记11   golang要用jetbrain的golang这个IDE工具开发才好  jetbrain家的全套ide都很好用,一定要dark背景风格才装B   从File-->s ...

  6. 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 ...

  7. Vim改装成一个IDE编程环境

      1 写在前面   Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Linux牛人, 黑客之类的也都不用IDE. 但是对我等从Windows平台转移过来的Coder来说, 一个 ...

  8. 04-手把手教你把Vim改装成一个IDE编程环境(图文)

    Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Linux牛人, 黑客之类的也都不用IDE. 但是对我等从Windows平台转移过来的Coder来说, 一个好用的IDE是何等的重 ...

  9. Ubuntu16.04 IDE: 用Vim逐步打造一个IDE

    目前打造完成的IDE主要有: terminator+Bundle+NERDtree+YCF(youcompleteme)+UltiSnips+新创建文件自动补充注释和作者,版权信息等 1,当任务比较多 ...

随机推荐

  1. iOS静态分析举例

    XCode-> Product -> Analyze 即可进行iOS静态代码分析.静态分析能发现的问题包括以下几种类型: 1.逻辑错误:访问空指针或未初始化的变量等: 2.内存管理错误:如 ...

  2. AX7: Overlayering and extensions

    Customization: Overlayering and extensions https://ax.help.dynamics.com/en/wiki/customization-overla ...

  3. centos下ssh无密码验证

    #安装openssh-clients,rsync等#1.修改所有master和slave服务器的sshd_config,后面增加UseDNS noClientAliveInterval 30RSAAu ...

  4. Thread.sleep(0)的意义& 多线程

    我们可能经常会用到 Thread.Sleep 函数来使线程挂起一段时间.那么你有没有正确的理解这个函数的用法呢?思考下面这两个问题: 假设现在是 2008-4-7 12:00:00.000,如果我调用 ...

  5. mongodb ubuntu下自启动

    个人测试开发的时经常会采用shell 启动mongodb,当进入项目团队开发测试时,必须让mongodb可以随系统自启动. 1.编写启动命令 sudo vim /etc/rc/local 1-1 mo ...

  6. MySQL临时表创建

    和SQL SERVER 创建临时表不同 不能直接写 Create table #Test_Table 而是需要在 Create 和 table 之间 加入 TEMPORARY(temporary< ...

  7. JVM基本结构

    以下是JVM的一个基本架构图,在这个基本架构图中,栈有两部份,Java线程栈以及本地方法栈,栈的概念与C/C++程序基本上都是一个概念,里面存放的都是栈帧,一个栈帧代表的就是一个函数的调用,在栈帧里面 ...

  8. Hibernate一对一外键双向关联(Annotation配置)

    如上图所示:一个学生有一个学生证号,一个学生证号对应一名学生.在Hibernate中怎么用Annotation来实现呢? 学生类,主键是id:学生证的主键也是Id: Student.java pack ...

  9. 8天掌握EF的Code First开发系列之5 视图、存储过程和异步API

    本文出自8天掌握EF的Code First开发系列,经过自己的实践整理出来. 本篇目录 视图View 存储过程 异步API 本章小结 咱们接着上一篇继续深入学习,这一篇说说Entity Framewo ...

  10. HMC破解控制台密码

    一般我们装完HMC以后默认的登录控制台的账户是:admin 密码:abc123当我们可以自创建登录账户后,忘记密码了怎么办? 这里有两种方法: 1 由于HMC是suse系统,基于linux内核的,所以 ...