10 Jan, 2015

Go is amazingly enjoyable language. Experience with it will be even greater once major IDE providers (yes, JetBrains I am looking at you!) start producing full-fledged Golang IDEs (instead of somewhat limited plugins). Before that happens, you are stuck with assembling a good toolset manually, so let’s do just that, for Vim!

0. Why?

There are plugins for Sublime, IntelliJ IDEA, Komodo etc so why do we need to do this for Vim?

Honestly, those plugins suck big time - they are hard to install, they are limited, they are not developed at fast enough pace. Don’t get me wrong, I will gladly switch to full-fledged Go IDE once it is ready, but before that, I am more productive on my default environment of choice i.e. Vim.

1. Discrete Runtime

Actually, nothing holds us from being productive right away. We already have:

The only problem is that Vim plugins and settings are being installed directly into your .vimrc and .vim. Therefore, it is hard to just try some setup.

I decided to create a simple runtime configuration that will be trivial to install (and uninstall!) and try.

So, without further ado, here we go: vim-go-ide.

Installation is as trivial as:

git clone git@github.com:farazdagi/vim-go-ide.git ~/.vim_go_runtime
sh ~/.vim_go_runtime/bin/install

i.e. you clone the repository into ~/.vim_go_runtime and run a script (which will create custom vimrc and write it as ~/.vimrc.go). Since we haven’t touched ~/.vim/ or ~/.vimrc, system’s configuration stays intact!

Time to see newly installed configuration in action:

vim -u ~/.vimrc.go

2. Non-Go (but essential) plugins

Here is a list of goodies (coming with this runtime) that are not Go-related but absolutely necessary for productive development environment:

The only Go-related Vim plugin you will ever need (the One to rule them all!!):

To make sure that all extra Go tools (godep, gocode etc) are present on your system, just run the following command from within Vim:

:GoInstallBinaries

4. How to use and extend

I highly recommend reviewing the .vimrc.go file - it has lots of clever tricks.

To extend Vim’s configuration, create/edit the .vim_go_runtime/custom_config.vim file and re-run installation script (actually look into its code to get the idea what it does).

5. Notes

Q.1 How to uninstall?

What, already? Well, if you absolutely need to:

rm ~/.vim_go_runtime
rm ~/.vimrc.go

Q.2 Who should I thank for this amazing work?

The work I’ve done is trivial (although I hope you will still find it useful).

This setup is heavily based on amiz/vimrc. Should you need some place to start with your Vim setup, there’s hardly a better place!

Now, when it comes to Go awesomeness - vim-go is all that we needed!

Q3. Which version of Vim was used?

I am using OS X Mavericks and it comes with Vim 7.3 without lua support (which is required by neocomplete plugin).

To fix:

brew install vim --with-lua --override-system-vim

Q4. Can I see how it all looks like?

Sure!

Screenshot

Follow @farazdagi Tweet