Switching to Vim
Since the start of 2012 I’ve committed myself to using Vim in my daily workflow. I’ve been familiar with Vim and the command line (bash) for several years, but it wasn’t until I a had a course in Linux programming that I became completely fascinated by the power of these tools. While IDE’s (e.g., Visual Studio, Xcode, Eclipse) and text editors (e.g., TextMate, BBEdit, Notepad++) are sufficient for their purpose, I wanted to become proficient in something that would significantly heighten my productivity.
Vim’s three modes (normal, insert, visual) + navigational keys (h, j, k, l) make editing files so much more efficient than the standard text editor (i.e., keyboard & mouse). While it took some time breaking my habbit of grabbing the mouse, it was well worth it.
While you can use Vim from the command line, I’ve chosen to use the standalone versions: MacVim and gVim depending on the current OS I’m on (MacOS, Windows, or Linux); the majority of my configurations work without fault on all three OS’s and on any recent version of Vim (7.2+). If I’m on Windows, I also install Git CLI for basic bash commands and of course, git (you can also use msysGit or Cygwin as more comprehensive alternatives).
When I can’t use Vim, and I’m using Visual Studio or MonoDevelop I make use of Vim plugins. For Visual Studio, I use the VsVim extension which emulates many of the important controls that are found in Vim. As for MonoDevelop, it has a built Vim plugin that enables the base modes and controls from Vim.
If you intend on installing plugins, then I highly recommend using
either Pathogen or
Vundle to manage installed plugins. I’ve used
both of these without an issue, but I have recently switched to Vundle for it’s
ease of installing plugins (i.e.,
:BundleInstall <name of plugin>). While
using pathogen, I installed all of my plugins as git
submodules, which allowed me
to easily mange and update plugins with ease.
I primarily use git to version my source code, so I figured it would be nice to have git integration in Vim. I’ve adopted Fugitive and gitv into my git workflow (by the way, this is a fantastic git branching model). Fugitive compliments the command line interface in just the right ways. If you’d like to know more, see this Fugitive screencast series. In addition to Fugitive, I began using gitv (a gitk equivalent for Vim) for viewing the repository log, branches, etc. While these plugins are not necessary, they make git that much more convenient.
Among the hanful of plugins that I use on a daily basis,
CtrlP is on the forefront. CtrlP allows me
to quickly navigate between files, with only a few keystrokes. I’ve configured
CtrlP to open when I press leader + t (
,t), and then all I have to do is type
a few characters of a file name to open it. For me, this a MUST have plugin!
Those are just a small subset of the plugins that I use. The complete list of plugins that I’m currently using are listed at the top of my vimrc file. Some of my other favorites include: Powerline, AutoComplPop, and SnipMate. Be warned, if you venture into the world of Vim plugins, you may never find your way out!
Tools of the Trade
As a programmer, the editor is probably the most important tool that I use. Since I’m exposed to it for hours upon hours every day, it only seemed appropriate to configure it to my liking. Until something better (maybe Light Table) comes along, I think Vim will be my daily driver for a while.
- vim.org - documentation, wiki, plugins, downloads
- Vim Casts - vim screencasts
- vim-scripts - github repository of vim scripts
Here are few sources that I used when configuring my setup.
- Ryan Bates - folder structure and rake install file
- Steve Losh - general configurations
- Yan Pritzker - general configurations
August 26, 2012