I’m a huge fan of my keyboard, the terminal, and generally keeping my hands off the mouse as much as possible. It’s probably some surprise, then, that it’s taken me as long as it has to adopt vim as my de-facto text editor. But despite the popularity that vi-style editors enjoy among members of the software development community, a intimidating list of commands and an (earned) reputation for a steep learning curve had kept me nestled in my comfortable GUI.
There are a few things I need from a text editor:
- Syntax highlighting
- Simultaneous access to multiple documents
- Regular expression support
Fortunately, nearly all of these features are available with my out-of-the-box install. As an added bonus, a few items off my editor wishlist are provided as well. Easy command line access with
:! was a nice surprise to find, as were the selection tools in visual mode (
v). I’m sure there will be more as I continue exploring.
On a daily basis I find myself writing and debugging code in a half-dozen different languages. Having at least rudimentary support for syntax highlighting saves me an enormous amount of time. I don’t need an editor that recognizes every jQuery event, but it’s at least nice to know that my strings are terminated correctly and my variables aren’t named after any obscure keywords. I’ve been very favorably impressed by both vim’s extensibility and community support—again, features that shouldn’t be a surprise in light of the software’s stellar reputation.
Vim’s tabbing mechanism offers a quick way to swap back and forth between open files. Unfortunately, the default commands are a little cumbersome for day-to-day use. The good news is that it’s easy to speed up tabbing with a few custom key bindings. Adding an old friend in for good measure, .vimrc ends up going a little something like:
" added keyboard bindings for tab selection map <C-t><up> :tabr<cr> map <C-t><down> :tabl<cr> map <C-t><left> :tabp<cr> map <C-t><right> :tabn<cr> " added ctrl+s map <c-s> <c-o><c-s><CR>
vim is thoughtful enough to track open tabs across the top of the screen, just as one would expect from a GUI editor. With these small modifications, I can flip through tabs as easily as I can in the browser. And I can even do it without a mouse!
If vim has a bone worth picking, this is it. The regex syntax is very nearly identical to the familiar structure of perl-style regular expressions, but requires escaping several familiar operators. It’s going to take some getting used to. The integration is fabulous, though, and I’m sure that comfort with the new flavor will follow soon.
If you haven’t played with vim before, maybe it’s time to take a look. The editor provides an incredible amount of power in a tight, keyboard-exclusive package. There are discrepancies in terminology that will take getting used to — yanking when I want to copy still doesn’t feel quite right — but it’s pretty obvious to me why vi-style editing is as popular as it is. Quick tabs? Syntax highlighting? No mouse? That’s about all it takes to get me on the bandwagon.