开始决定丢弃鼠标,所以准备用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. jQuery.ajax()调用asp.net后台方法

    利用JQuery的$.ajax()可以很方便的调用asp.net的后台方法.介意方法名不要重名 建一个WebFormAjax名aspx文件 CS <%@ Page Language=" ...

  2. ios 使用Core Image实现高斯模糊

    在iOS和OS X平台上,Core Image都提供了大量的滤镜(Filter),这也是Core Image库中比较核心的东西之一.按照官方文档记载,在OS X上有120多种Filter,而在iOS上 ...

  3. 《UNIX/Linux网络日志分析与流量监控》新书发布

    本书从UNIX/Linux系统的原始日志(Raw Log)采集与分析讲起,逐步深入到日志审计与计算机取证环节.书中提供了多个案例,每个案例都以一种生动的记事手法讲述了网络遭到入侵之后,管理人员开展系统 ...

  4. JVM GC原理

    JVM原理 1.分代回收(目前JDK都采用此方式) 采用分治的思想,进行代的划分,把不同生命周期的对象放在不同代上,不同代上采用最适合它的垃圾回收方式进行回收.非堆区有CMS Perm Gen(持久化 ...

  5. [转载]jquery中attr和prop的区别

    在高版本的jquery引入prop方法后,什么时候该用prop?什么时候用attr?它们两个之间有什么区别?这些问题就出现了. 关于它们两个的区别,网上的答案很多.这里谈谈我的心得,我的心得很简单: ...

  6. assert的用法

    assert用来调试时,判断一个语句是否为真. assert是宏,而不是函数.在C的assert.h 头文件中. assert的作用是先计算表达式 expression ,如果其值为假(即为0),那么 ...

  7. Java基础常见英语词汇

    Java基础常见英语词汇(共70个) ['ɔbdʒekt] ['ɔ:rientid]导向的                             ['prəʊɡræmɪŋ]编程 OO: object ...

  8. ASP.NET泛型List的各种用法Skip、Take等

    List在.NET里面使用得非常频繁,但有好多人不了解它各种小用法.我就一直记不大住... asp.net中List的简单用法,例如: 1 2 3 4 5 6 7 List<int> li ...

  9. VFP调用SOAPTOOLKIT 低级API

    Connector=CREATEOBJECT("mssoap.HttpConnector")Connector.Property["EndPointURL"] ...

  10. HDU 5410 CRB and His Birthday ——(完全背包变形)

    对于每个物品,如果购买,价值为A[i]*x+B[i]的背包问题. 先写了一发是WA的= =.代码如下: #include <stdio.h> #include <algorithm& ...