I don’t actually expect it to lead to a flamewar here, but I am nevertheless invoking one of the longstanding Internet disputes with this announcement: I have recently switched from emacs to vi1.
For the uninitiated: emacs and vi are the two most common text editors in Unix environments. They’re meant for editing unformatted text such as computer programs. I’m doing a lot of Unix programming these days (in Perl and C++) so a good text editor is essential. The two have fairly different philosophies: emacs does more or less what you would expect, in that you can type words and they appear on the screen, but it also has a ton of extra functions (such as programming with butterflies). Unfortunately even simple ones like, say, “save” have to be accessed by typing a sequence of obscure key commands, usually while holding down the control key.
On the other hand, if you open up a file with vi and start typing, words will not appear on the screen. If you’re lucky it’ll just beep at you repeatedly; it might also start deleting portions of your file apparently at random. Fortunately you’ll never figure out the command to save, so your original file will be unharmed; unfortunately you’ll never figure out how to quit either, and be stuck there forever (or until you open up Google and look it up).
At least, that was my first experience with vi, and having concluded that it was designed by alien intelligences I quickly became a convert to emacs. However, I recently began to question that decision, for a number of reasons:
- Peer pressure. Almost everyone in my department uses vi. In fact, when I was assigned to a newly assembled Unix box and complained to the sysadmin that emacs wouldn’t run there, his response was “Well, most people use vim.” (He did set up emacs for me despite his disdain for it.)
- It reminds me of playing nethack. At some point in the past I had to learn to play nethack on a laptop keyboard (i.e. without the number pad), and only later found out that I had thus inadvertently learned how to move the cursor in vi3. This was actually the biggest part of the learning curve. There are other similarities to nethack, such as the primitive-looking interface, the obscure extended commands, and the fact that a typo at the wrong time can kill you.
- I got tired of holding down Control every time I wanted to do anything. (But hitting escape to get out of insert mode is almost as bad. Maybe I should remap it to some other key.)
Anyway, I went home one night and went through the vim tutorial, and discovered that it’s not as hard as I thought, and ended up switching entirely.
Rather than actually make this an editor wars thread, consider this a place to suggest your favorite Unix programs for software development (or whatever else).
1 Actually, vim2.
2 Well, technically gvim.
3 Except that the diagonal movement keys do other, more drastic things in vi, which can cause trouble when I forget I’m not playing nethack.