Mastering Vim Quickly - A Short Review
I wrote about Practical Vim a while ago, and since then I have been trying to improve my Vim in a number of ways. One of which is, coincidentally, reading more books about Vim.
One that caught my attention, mostly due to its Twitter feed (which I recommend you check out, it’s really quite good) was Mastering Vim Quickly by Jovica Ilic. I deliberated whether I should buy it for some time - you know, too expensive, got so many books I haven’t read lying around already - but after some time my curiosity won out.
I’m gonna be honest, this book didn’t leave me totally blown away. That doesn’t mean that I’m unhappy that I bought it, I just felt that there was some wasted potential, and maybe some issues with how the book was advertised. I really don’t think Mastering Vim Quickly can hold the torch to Practical Vim when it comes to learning Vim from scratch. Mastering Vim spends little time on basics, and goes not nearly as much into depth on various topics (Registers, Buffers) as Practical Vim does. Which is fine: One book has nearly three times the pages of the other.
The Good Parts
So, Mastering Vim might be ill-suited for absolute beginners. Who it is suited for though, is people who are interested in learning about some of the more arcane features of Vim. It becomes clear pretty quickly that the book is basically Jovica Ilic showing you many of the tips and tricks that he personally learned and found useful on his Vim journey. Some of which might not be super useful to you, but most of which give you this feeling of ‘Oh yeah, that always bothered me, good to know that this is how I can fix it’. Quite nice actually.
In the introduction Jovica details how one should approach learning Vim, and what learning techniques he himself uses. A ‘learning 101’ if you will. The following chapters concern themselves with the basics of Vim: Modes, Working with Files, Navigation and Search. There I found this little beauty:
- You can edit remote files using SSH or FTP using Vim. The power of the built-in
netrw
-plugin makes it so that you can simply dovim scp://user@server//path/to/file.md vim ftp://hostname/path/to/file.md
to edit files on some remote host. I could have used this a couple of times already, had I just known about it earlier!
Jovica also describes how to customize Vim and how to properly use Undo-Redo. Customization is a big part of Vim, and there are bound to be some customization options that are a matter of personal taste. I still found some very useful infos:
- Dealing with Swap Files. Swap files have been a bit of a pain for me lately. I really don’t appreciate the fact that swap files might pollute some directories, but on the other hand, I don’t want to lose my progress due to some error. Jovica suggests using an external swap file directory:
set directory=$HOME/.vim/swp//
- Using Project Specific
.vimrc
. In order to keep your main.vimrc
clean you can tell Vim to use a.vimrc
that is located in the root of your project folder:set exrc
- Persistent Undo. I absolutely love this feature: No longer will I lose my undo history when accidentally closing Vim! You may tell Vim to save the file history in an external file. Per default, this would create a hidden file in the same directory as the file you are editing. Luckily, you can specify an external folder as well:
set undofile set undodir=$HOME/.vim/undodir
- Undo Branches. I didn’t know Vim’s undo history is non-linear. You can undo and redo select items regardless of where they are in your history. Sounds a bit complicated, but I’ll definitely give this one a try.
The next chapters were about Text objects, Registers, Windows, Macros and Visual Mode, and after that: ‘Productivity Tips’. Oh yeah. This chapter probably had the highest density of neat little tricks. Some of my favourites:
- Relative Numbers. When you use commands like
10j
often, you might want to prefer not absolute, but relative numbers to be displayed in Vim. To enable that simply put this in your.vimrc
.set relativenumber
- Using Space as Leader. Dunno why I didn’t think about this. You can remap the default leader key to space, which makes it a lot easier to use.
The book closes with some remarks on how to continue learning Vim. There was much more to this book that I described, and I recommend that you have a look on Twitter to get a feeling for what kind of content you can expect. Overall it left me quite eager to try out some new stuff, which is all I could really ask for.
TL;DR
Mastering Vim Quickly might not be the best book to get started with Vim, but still contains a lot of useful nuggets of knowledge that you can integrate into your workflow. Although not a must-read by any means, I still quite enjoyed it.