Home :: Vi and Emacs

What and What Now?

Vi and Emacs are two of the oldest and most popular text editors around. They’re both very powerful, but not easy to learn. For some idea of why you might want to make the effort, aimed at anyone who writes (types) a lot, you might want to see my previous article on Text Editors for Writers.

Very briefly, once learned, they’re the fastest way of editing text – but the unusual keystrokes might give you problems if you still have to use lots of other programs.

A Bit of History

Both of these editors have a long history. They go back over thirty years, which is a long time for any software to last. You can guess from this that they must be doing something right for some people at least.

The Editor Wars

Some people take their choice of editors really seriously. See the Wikipedia article for the Editor War to see how seriously. The two main sides in the battle are Vi and Emacs.

The Differences

Architecture and Design

  • Vi is fairly simple – it’s just a fairly small, fast text editor – it’s just a small program you run, which can open, edit, and save text files.
  • Emacs is an editor built around a Lisp interpreter – so it’s part editor, part programming language. Extensions and add-ons can be written in Emacs’ elisp language, and can be run inside Emacs, changing the way it works. This means that Emacs is almost infinitely extensible, and also quite big. It used to be thought of as quite slow, but on most modern systems, it’s actually pretty speedy.


  • Vi users claim they are closer to the Unix philosophy, because Vi does only one thing, and does it very well – editing text. Unix tools, traditionally, don’t try to do anything but what they’re designed to do.
  • Emacs users claim they are closer to the Unix philosophy, because Emacs is so extensible and programmable, and can be turned to do almost anything you want.

Personally, I think the Vi users have a better argument here, but it’s certainly true that you can write Vi in Emacs, but you couldn’t ever write Emacs in Vi.

Modes or Modeless

  • Vi has modes. When editing, there’s two main modes – command mode and insert mode. You can only enter commands in command mode, and you can only type text in insert mode. Beginners often forget which mode they’re in, and try to type in command mode, and end up issuing whatever commands they just happened to type. It takes quite a bit of getting used to.
  • Emacs is modeless. You could probably argue that a command mode still exists, but for the most part, if you type text, it appears in your document. Commands are accessed through Ctrl- and Alt- key combinations (though Emacs insists on calling Alt ‘Meta’).


Both editors aim to save typists from having to move their fingers from the home keys. With most text editors, you have to keep reaching away from the home keys to reach for the arrow keys, or funcion keys. Both Vi and Emacs save you from that.

  • Vi uses single letter commands. Because of the command mode, it doesn’t have to avoid using letters, so moving left can be done with the ‘h’ key, down with ‘j’. ‘0’ will take you to the beginning of a line, and ‘i’ will start inserting text. The only problem comes when you need to switch back from insert mode to command mode, when you have to reach all the way up to the Esc key.
  • Emacs uses combinations of keys – Ctrl-b will go left, Ctrl-n will go down a line. Ctrl-a to go to the beginning of a line. Things that can’t be fitted onto Ctrl- combinations are often on Meta- (Alt-) combinations. Ctrl-Shift- combinations are also used, as are Meta-Shift- combinations. Then there’s commands on combinations of keystrokes, so Ctrl-x followed by Ctrl-s will save, and Ctrl-X followed by Ctrl-c will close Emacs.

Personally, I find reaching for Esc to be a bit irritating in Vi, and no matter how long I use it, I never quite stop trying to type in command mode. I’m getting better, though.

All the key combinations with Emacs can be a bit much, though, and I never could remember if it was Ctrl-x then Ctrl-b or Ctrl-x then b to switch buffers.

My Choice

I very nearly switched completely to Emacs recently, and was really enjoying using PlannerMode for GTD, but hit a bit of a drawback.

I have to switch back and forth a lot, between my editor and my browser, often copying and pasting between the two. That gets confusing when each uses different keystrokes for things as simple as copy and paste.

That drove me away from Emacs, but after trying a few others, and almost settling that I’d have to go back to PSPad, I finally noticed something that I probably should have checked a long time before: Vim does use the Windows standard keystrokes for copying and pasting. Since I like the way it works for most other things, that might just be enough for me to stick with it. I’m using it now to write this, anyway 😉

(Vim? I thought it was called Vi? Yes – Vim is ‘Vi IMproved’ – an extended and modernised version of Vi. Some purists think it’s lost some of what made Vi so great, but for most people, on a reasonably modern machine, it’s much nice to use.)

Anyway, if you’re geek enough to want to use Vi or Emacs, I’m sure you already know what side of the battle you’re on.

Tip Jar

Liked this post? Leave a tip - $1, or send multiple if you like!


Comments are closed.