Book Review: Practical Vim

Practical Vim Book CoverI picked up a copy of Drew Neil’s Practical Vim on a lark.  With Java being my main programming language for professional use, I spend most of my time coding within an IDE.  For over a decade that was Eclipse, and more recently it’s been IntelliJ, but I would definitely not use a plain text editor for non-trivial Java development.

I do use vi/Vim when I’m forced to edit something within a shell session.  However, for the most part I’ve always just installed gedit on my Linux boxes, and Notepad++ on my Windows boxes, and rarely used either one of them.  I read “editor war” threads on Hacker News or Slashdot with some mild, detached amusement.

However, over the past couple of years I’ve been doing a lot work with Go.  That sparked an interest in text editors, since the current generation of Go IDE’s is still rather immature.  A short-lived experiment with Emacs nearly killed my pinky finger, and I’m not paying $70 for a text editor no matter how popular Sublime might be!  So that left Vim as the only option with serious plugin support for Go.  But in the 21st-century, is this 1970’s relic really a serious option?

In a word… YES!  Practical Vim completely changed the way that I think about this editor.  After just a couple of weeks of working through the “tips” in this book, I couldn’t imagine going back to writing code with a tool that doesn’t at least emulate Vim’s main features.

Vim ships with a built-in tutorial, and I was expecting Practical Vim to be nothing more than an enhanced version of that.  Start with the basic home-row movement keys, and slowly crawl toward cut-n-pasting, etc.  Amazingly enough though, Neil makes it over one-third of the way through the book before he bothers covering “fundamentals” like cursor movement… and yet the book layout decisions actually feel natural and make a lot of sense.

The very first thing covered, using the period (.) and semicolon (;) keys to repeat actions, isn’t even in the Vim tutorial at all!  It turns out that repeatability is one of Vim’s most powerful features… and after two decades of using the editor, I had no idea that it even was a feature!

The material only goes up from there.  It’s a steady barrage of little “eureka!” moments.  For example, the main thing I always hated about Vim was its modal nature.  Having to constantly stop what you’re doing, and reach over to hit the key, felt much more clunky and disruptive than switching between keyboard and mouse.  Less than 30 pages into the book, Neil casually mentions that -[ is an equivalent for .  Why have I never seen this shouted from the rooftops, or at least mentioned before?  It’s a million times more ergonomic than , because you can just lean the side of your left hand onto the key and press [ with your right hand… one fluid motion without leaving the home row.  Suddenly, toggling modes isn’t disruptive anymore!  Overcoming this resistance to modal editing helped open my mind to all of its advantages, which are legion.

I liked the way that Practical Vim is built around 121 “tips” (what most technical books call “recipes”).  You can read the book as a linear series of chapters, but the format makes it convenient to jump around and refer back to concepts later.  It also makes it easy to internalize the material through practice.  Pick two or three “tips” to practice with each day (each tip is only a couple of pages), and within a week or two you will be shocked at how fluid and effortlessly you’re able to edit.

Due to the nature of my work, I still spend most of my time in an IDE.  However, I’ve discovered that there usually are Vim-emulation plugins available (I recommend IdeaVim for IntelliJ and other JetBrains IDE’s, and Vrapper for Eclipse).  I’ve even discovered web browser plugins, that let you use Vim-like key bindings to “click” on links and navigate between pages or tabs without leaving the keyboard (VimFx for Firefox, and Vimium for Chrome).  At this point it feels unpleasant to use data entry tools that don’t offer a “Vim-mode”… such as word processors, or this WordPress editor!

“Editor wars” are silly.  If you’ve invested significant effort into learning how to maximize productivity in your chosen editor, then by all means go forth and enjoy that editor.  However, if you haven’t ever deeply explored an editor’s features… if you’ve spent your entire career working in default “Windows Notepad”-mode without thinking about it… then I highly recommend spending a little time digging into some text editor.  Vim is an excellent and hyper-productive choice, available virtually everywhere, and Practical Vim is probably the best resource for guiding you through it.

comments powered by Disqus