In defense of vi

June 14, 2010

Sadly, I was unable to attend RailsConf this year. It was in Baltimore, and it would’ve been a lot of fun, but it just wasn’t in the cards. One of the great things about RailsConf is that the videos are posted online very quickly and are always of high quality. While I always like hearing DHH speak, I try to never miss one of Uncle Bob Martin, author of the must-go-read-this-right-now Clean Code.

This year, he gave an awesome talk on the (lack of) innovation in software development. He pointed out that we were still writing the same type of code now as we were 40 years ago. In one part, he asks the crowd what editor they use (knowing full well most will say vim). He then proceeds to make light of the audience for using a 19-year-old editor based on a 34-year-old editor. While his criticism is brief, I think it speaks more to the sorry state of text editing than to the developers (like me) who are “still” using vim.

I’m sure that unclebob is one of the more advanced IDE users, but it just pains me watching my co-workers meander through their code, selecting things with the mouse, and deleting long swaths of text by just hitting the delete key a lot.

While an IDE is great for learning a new environment (especially one as pedantic and verbose as Java or Objective-C), the editing capabilities are counter-intuitive and degenerate. vim may be hard on the newbie, but it’s intuitive and logical. When you understand the “zen” of vim, you can fly through your code, playing it like a musical instrument. It affords muscle memory and allows sophisticated chaining of movement, intent, and action. You can see what you want to accomplish and your hands make it so, all without reaching for a mouse, cursoring, using the delete key, or contorting your hand with some awful combination of key modifiers.

Think of it as a piano; it’s a very simple base of simple sounds and actions that, when chained together, can be used to make beautiful music. An IDE is more like a fancy Casio keyboard with built-in songs and beats. Shiny, but hollow.