At Signal Sciences we use golang for just about everything. I thought I would write a little 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’s gotten even more complicated now as younger programmers are all about Atom. Atom is a editor released by github with lots of great features. It even has vim bindings.
In this post, I will cover the two major components in my personal setup: vim-bootstrap and vim-go. Also, I will cover how I use github and make to keep my vim setup working across laptops and development environments.
Lets start with vim-bootstrap. With it you can 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 its easy to just get a fully working vim config with just a few clicks.
A generator which provides a simple method of generating a .vimrc configuration for vimvim-bootstrap.com
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. Its very feature rich. During my usage of vim-go I had always been sure that I had been 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 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 just 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 flow 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 again 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 gives you some launching points in your journey for using vim. I can’t say enough good things about vim-bootstrap and vim-go. Let me know what you think.
Thanks for reading
I wrote a short book on The Roadmap for DevOps and Security that outlines the 4 key areas Security can provide value in a DevOps organization. At Signal Sciences we provide a modern approach to application security and web application firewalls that DevOps shops love. I hope you find it useful.