Skip to content →

On Vim

I just read Brett Hoerner’s blog post entitled “On Emacs” and it yielded a response from me!

Let me start by saying that I love vim for numerous reasons, but here are the major ones:

  • vim makes amazing use of the home row
  • SUS and POSIX make it one of the most widely available editors to ever grace a terminal
  • vim is modal, meaning you’re in one mode at a time (e.g. insert mode versus command mode)

I used to use Emacs. I’ve got nothing really against it. Emacs gets things done. It’s just that in my opinion, vim gets things done faster.

I’m in love with not taking my hands off the home row. In Xmonad, all of the key bindings are based on Alt, meaning my thumb can tap Alt, while my other fingers rest on the home row. That means I can transition between editors and windows and make changes while usually never having to leave the home row. Examples of this include a key sequences like dd, Alt+k, etc. I’ve even got the key sequence ‘jj’ bound to be ESC, so that I don’t have to reach for the escape key.

This can be contrasted with Emacs using an example: text search. Search for the word “cat”. Emacs: C-x-s cat. Vim: /cat. No reaching for Control, which puts your fingers in an awkward position and off the home row, no key sequence, full regex support off the bat, and so on.

Brett makes a great point in his post, stating that step 1 of using Emacs is to customize it. Unfortunately, when I learned Emacs in the mid-90s, my step 1 was learning to navigate, learning to copy/paste, etc. That time period made it especially hard to get information on how to customize it. And despite the advent of good search engines, I think this still holds: users coming into Emacs are overwhelmed just trying to get things done and don’t “have time” to customize things they don’t like. Customization comes later.

Brett makes another excellent point in stating that editing a vimrc is difficult. I feel Emacs/Elisp are equally at fault here. I’ve found that one’s ability to customize their Emacs or Vim config is directly correlated to the size of their beard. I have a small beard, and assuming that correlation is causation, I thus limiting my ability to edit my vimrc with changes that I’d really find useful (example: some-key-combo => auto-format all source code in file; Eclipse, I’m looking at you!) And don’t newbs find more sense in vimrc speak? Assuming you don’t learn Lisp prior to your Emacs years, Emacs configuration can be pretty daunting. But, I bet 99.9% of all vim users can read a vimrc file with some semblance of understanding. Moreover, I bet those same people can copy/paste portions from other vimrc files and get up and going a bit more quickly.

Besides all of these efficiency things, one must also consider the breadth of the vi/m install base. I can go to any *NIX terminal booted after I was born and find some flavor of vi. This isn’t the case for Emacs.

Lastly, we’ve got modal editing. This is where vim really shines, in my opinion. Insert mode is for inserting. There are tons of little conveniences for popping into insert mode in vim, often only differing by how they place the cursor. And those conveniences are available for every command mode command I’m aware of. Add visual mode onto this, and you’ve got the complete package for navigating while editing quickly. The part that turns people off is switching between modes quickly. They don’t know all the nuance shortcuts that make going from visual mode to insert mode to command mode extremely fast. People tend not to learn these because modal editing confuses them, so I think there’s a wall that people hit when they want to advance beyond i => ESC => hjkl => i => ESC => repeat. 0, $, ^, d$, d0, yy, dd, p, P, {, }, n, N, v, etc. These are all important basic commands that are really what add productivity. If a user fires up vim and exclusively uses i, h, j, k, l, the experience is going to suck. It’s the commands that move between modes that make vim sparkle. Also, as I said, binding ‘jj’ to ESC helps a lot. In Emacs, since there are no such modes (there are modes, but the term mode means something different in the Emacs context) performing all of these operations must be a much more complicated key sequence. By simply wrapping a context around a key, we avoid long key sequences and command keys altogether.

Just my two cents 😀

Published in Uncategorized