Becoming a vim ninja

by Neville Samuell

A month or two ago I decided to finally start training in the secret art of vim-jitsu. I had been using vim as my editor of choice for awhile but, to be honest, I mainly used it like Notepad++ with better regex support. Then after I came across Derek Wyatt's excellent screencasts and started really using the movement commands to skip around my source files, I realized that I was doing myself a disservice by not giving vim a fair chance, so I took the plunge and disabled my arrow keys for good.

From "BASIC Movement", one of Derek Wyatt's videos, which you really should check out

From "BASIC Movement", one of Derek Wyatt's videos, which you really should check out

For the first week or two it was a bit confusing remembering to use 'h' instead of the left arrow, but it turns out that style of thinking is the wrong way to approach it entirely. Even though you eventually get used to the home row configuration sufficiently to stumble around using per-character motions, I found most of the benefit from disabling the arrow keys came indirectly; I started using word actions (e.g. 'w' and 'b') and search actions (e.g. 'f' and 't') more often, and what a difference something minor like that can make. Once you get used to chaining these kinds of movement commands together, other things start to make more sense as well: previously if I wanted to replace a couple words on a line I probably would use ':s' to search & replace, but now I'll typically just repeat my previous 'cw' command using '.', dancing to the next match with 'n'.

At the end of the day, it's still not a huge difference between then and now. I'm still new to using vim effectively, but I'm starting to see why there's always some guy extolling the virtues of vim at every event I go to. I'll probably start being 'that guy' fairly soon.