The Next Jump blog is a look into the culture of a company that believes corporations can change the world.
Vim - Next Jump Style with Jarvis
Caleb
27 Jan

Next Jump’s Vim lovers have come together to collect, document, and open-source some of the best plugins, shortcuts, and user commands into one .vimrc. We hope that our setup, which we call Jarvis, can help anyone hit the ground running with an awesome Vim configuration.

Gvim Screenshot

The Motivation

    Next Jumpers are a diverse group. This diversity translates to our choice of coding environment as well. If you have ever watched someone who has mastered their editor write code, you know it is a thing of beauty. They quickly open files with a few key strokes, use shortcuts for all of the common commands, quickly hop to the location they want to edit in a file, and employ a host of other shortcuts or plugins that generally make them very, very fast. I witnessed this for the first time when I originally joined Next Jump. A senior engineer had spent years working in Vim, and watching him code with it was simply amazing. His hands never left the keyboard, he moved around a file faster than you could with a mouse and I was inspired to immediately begin using Vim. Unfortunately, my aspirations of becoming a Vim master shattered nearly immediately. One of my favorite images on the internet parodies the learning curve for a few popular editors:

Learning curve

    I have since become an avid user of Vim and have spent countless hours customizing my own configuration file. Mastering the tools you work with every day while coding is an important part of being a good engineer. It surprises me how often people simply take the vanilla settings of a text editor or an IDE and never attempt to modify them. I was discussing this with a few engineers during a Dev Poets Society meeting and we began to talk about our own Vim setups. It was surprising how many awesome plugins and shortcuts we discussed that I’d never known about. So we decided to combine our efforts to come up with Next Jump’s first company-wide .vimrc. It has some of the good stuff that almost every Vimmer should have: Nerdtree, Ctrlp, Syntastic, Tagbar, and BufExplorer. It also has some lesser known plugins and a collection of settings, customizations, and shortcuts that have proved beneficial to our productivity.

Features

     One of the best ways to measure the effectiveness of an editor is how you can use it to handle common programming tasks and problems. The setup is very thoroughly documentated but if you are new to Vim here are some highlights of how this setup can help improve your productivity (please note that here we have mapped the , key as the leader):

  1. Dealing with multiple files - Programming frequently involves switching back and forth between a group of files. With Jarvis, you can type ,be to open BufExplorer and see a list of recently used files or ,b and begin typing the name of the file to have CtrlP fuzzy-find the file in your buffer.
  2. Finding a file - Typing (ctrl)p (for sublime users) or ,t opens up CtrlP and lets you search your current project for a file name. Want to browse the directory of the file you are working on? ,f jumps to the location of the current file in NerdTree, a tree explorer plugin.
  3. Syntax checking - With the Syntastic plugin you get real-time syntax checking in a ton of different languages.
  4. Auto-complete - With SuperTab and PHPComplete you can type $this->(tab) or self::(tab) to generate a list of possible completions. This is a huge timesaver and also works with variable names.
  5. Function jumping - Want to jump to the spot a function was defined from a call in your current file? With ctags you can use Vim's built in (ctrl)] with your cursor on the function to jump to the function definition (even if it's in a new file).
  6. Writing HTML - Web developers often run into the tedious task of typing out large blocks of HTML. Sparkup allows you to type an abbreviated version and type (ctrl)e to generate the valid HTML. For example: table > tr*2 > td.name + td*3 expands to:
        <table>
            <tr>
                <td class="name"></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td class="name"></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    

For a full set of docs please check out the git repo and please don’t hesitate to fork and send pull requests for improvements or report any issues.

Happy Vimming!
Next Jump

blog comments powered by Disqus