At Signal Sciences we use golang for just about everything. I thought I would write about my local vim setup and doing go development with vim.
Writing a blog post on vim is a bit daunting. Sysadmins and programmers have debated the virtues and perils of vim for many years now. The vim vs. emacs debate still carries on, but it has become even more complicated now as younger programmers are all about Atom. Atom is an editor released by Github with lots of great features such as vim bindings.
Let’s start with vim-bootstrap. It allows you to select which languages you are developing in (HTML, golang, ruby, …) and the version of vim you are using. After these few basic selections it generates a .vimrc that works. Before using vim-bootstrap I tried (mostly unsuccessfully) keeping up with vim plugins, but now it’s easy to get a fully working vim configuration with just a few clicks.
The config I use calls the vim-bootstrap API and downloads the config as part of the install. More on that later.
The second major component of my setup is using vim-go. Unlike other languages with vim where you often add in a series of plugins, using vim for go programming is just adding one plugin to your .vimrc. It’s very feature rich. During my usage of vim-go I had always been sure that I was barely scratching the surface. Turns out, I was right!
The vim-go creator Fatih Arslan created an incredible tutorial for learning vim-go.
What’s even better is that he also released a video last week that walks through the entire tutorial.
I highly recommend checking both of these out and working through the tutorial. If you end up using the vim config that I do, you will see several of the modifications that Fatih Arslan recommends. If you really like my personal setup, feel free to tweet out the link to this blog to any go programmers you know!
That brings me to the actual setup of vim.
Version Controlled Config
I keep my vim config inside of a Github repo. This helps me create a portable way to take my config with me and also make sure that changes are tracked. Sometimes vim-bootstrap changes things that I want to inspect, sometimes I want to test a new plugin, but mostly I want the portability and the log of all the changes I make to my config so I don’t have to remember them.
To get started with wickett-vim, it’s as simple as cloning the repo and running make install.
The install does several things, but notably it symlinks in all its config into your home directory and then runs an install of all the plugins.
Making It Yours
Inside your .vim directory you will see there are two files with local in their name: vimrc.local and vimrc.local.bundles. There is also a stub in the Makefile for update. The workflow that I like to use is to add my changes to vimrc.local and vimrc.local.bundles. To stay in sync with vim-bootstrap I run Make update every now and then and use git diff to check out what changes it made and see if I want to keep them.
I hope this was interesting and provides some launching points for your journey using vim. I can’t say enough good things about vim-bootstrap and vim-go. Let me know what you think.Recommended reading: The Ultimate Guide to Web Application and API Protection (WAAP)