Skip navigation

Monthly Archives: August 2011

I’ve been trying out Vim again after a year of Emacs, and I find modal editing awkward now. The advantage of modal editing is that it decreases the reliance on modifier keys, but it comes at a price:

– Modality is a HCI mistake in general. You get used to being concious of the current mode after a while, but you can still wreck havoc if you eg. miss i or : and start typing. Modeless editing is much less “error-prone”.
– Moving within a line and adding characters here and there requires constantly entering and exiting insert mode, unless you want to succumb to using the arrow keys.
– If you make a mistake in insert mode, such as hitting ctrl-U to delete to beginning of line, you can’t undo it; undo can only be accessed outside insert mode, and it undoes the entire insert mode session. So if you had stayed in insert mode for a while before the accidental ctrl-U (such as when typing out a paragraph) you’re pretty much forced to retype the line you deleted.

For these reasons, I believe modeless editing makes much more sense. Emacs’ default key bindings are far from optimal though; I think that’s why modeless editing has a bad rap.

Bill Joy, author of vi:
«I wish we hadn’t used all the keys on the keyboard. I think one of the interesting things is that vi is really a mode-based editor. I think as mode-based editors go, it’s pretty good. One of the good things about EMACS, though, is its programmability and the modelessness. Those are two ideas which never occurred to me. I also wasn’t very good at optimizing code when I wrote vi. I think the redisplay module of the editor is almost intractable. It does a really good job for what it does, but when you’re writing programs as you’re learning… That’s why I stopped working on it.

What actually happened was that I was in the process of adding multiwindows to vi when we installed our VAX, which would have been in December of ’78. We didn’t have any backups and the tape drive broke. I continued to work even without being able to do backups. And then the source code got scrunched and I didn’t have a complete listing. I had almost rewritten all of the display code for windows, and that was when I gave up. After that, I went back to the previous version and just documented the code, finished the manual and closed it off. If that scrunch had not happened, vi would have multiple windows, and I might have put in some programmability—but I don’t know.

The fundamental problem with vi is that it doesn’t have a mouse and therefore you’ve got all these commands. In some sense, its backwards from the kind of thing you’d get from a mouse-oriented thing. I think multiple levels of undo would be wonderful, too. But fundamentally, vi is still ed inside. You can’t really fool it.

Its like one of those pinatas—things that have candy inside but has layer after layer of paper mache on top. It doesn’t really have a unified concept. I think if I were going to go back—I wouldn’t go back, but start over again.»