Wandering Thoughts archives


A little vi twitch

I am not the world's most sophisticated user of vi, but I have a number of little twitches. One of them is that I never use either ZZ or :wq; instead I always use :w and then :q. I know the commands, but I just don't like them for the fundamental reason that they're not vi commands.

Well, obviously they're vi commands in one sense. But they aren't in the sense that they break the rules of vi commands. Vi commands as I remember them are single letters, both for 'action' commands and for : commands, and both of these fast-exit commands break the rules. (ZZ breaks them flagrantly; a doubled action command normally applies to the line that you're on, whereas if ZZ applies to anything, it applies to the entire file. And of course there's no Z command.)

(I expect that modern versions of vim have all sorts of multi-letter commands. I ignore them, or more exactly I don't even go looking for them so I have no idea which ones exist beyond :set. One of these days I will actually find and read a complete index of vi commands, but in the mean time I get by.)

These fast-exit commands may be convenient, but for me they are not worth using precisely because they break the rules. I would rather exit from vi slightly slower and with more steps in exchange for preserving vi's useful regularity in my mind and in my reflexes.

(I'm aware that I'm preserving an illusion, but it's a useful illusion. By the way, this has nothing to do with vi versus vim, as both of these commands were in the original BSD vi.)

unix/ViTwitch written at 02:09:26; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.