I recently obtained a copy of the book Hacking Vim by Kim Schulz and published by Packt Publishing. For the record, I’ve read a few vim books; I have O’Reilly’s vi Editor Pocket Reference on my desk, as well as Learning the vi Editor.

Neither book compares to Hacking Vim. This book was an absolute treat to read if you are a vim power user or want to be. If you’re just using vim occasionally on remote systems or your usage is sporadic, then this book might not be for you. However, for someone who wants to take their vim usage from just casual text editing to doing some very powerful and productive things with it, you’ll learn a lot from this book. I’ve been using vim for a few years now, and I’ve learned a lot of new things and seriously tweaked out my vim configuration as a result.

The book recaps the history of vim and other vi-like editors, but unlike other books I’ve read, the introductory content is brief. The book proceeds logically from configuration basics to the more advanced things you can do with vim. It also covers the GUI version of vim (gvim) for those who want to use a GUI text editor.

To start with, it discusses the various configuration files and how to do basic things like change fonts, colors, the status line, and so forth. This first part is all about customizing vim’s appearance so that it works and looks the way you want it to. It also discusses topics, such as setting up a spell checker and changing the default key bindings.

Next, it covers navigation in vim: movement keys, dealing with buffers, searching in files, and markers. This is largely standard fodder for any vim book or tutorial, but unlike other books I’ve read, this one provides some great examples and illustrations.

In another chapter Schulz provides tips on boosting productivity. There are some real gems in this chapter, such as using template files to speed up document creation and using and creating auto-completion commands to make typing the same thing over and over again less tedious and time-consuming. Here are some of the other subjects covered in this section:

  • How to use and record macros in order to make vim do specific things at the touch of a key (or button)
  • Using sessions with vim (something that was entirely new to me)
  • Using registers and undo branching with some great examples that really make it clear
  • Text file folding (such as folding code functions)
  • Using vim as a simple outliner
  • Opening remote files easily

The Advanced Formatting chapter covers topics a lot of other books do as well: how to format text, using various indenting methods, and also discusses external formatting tools.

The final chapter of the book weighs in on scripting vim, which is a powerful means of further customizing this editor. It discusses topics like writing the actual scripts, writing syntax and color scheme files, and using vim with external interpreters such as perl and python.

All in all, I highly recommend this book if you are at all interested in making vim a highly productive text-editing environment. I found it to be well written with great explanations and insight, and it covered a lot of topics that other books on vim never touched.