On many Unix systems, if your machine blows up and you're responsible for the recovery process, often vi is the only available editor on the recovery CD. It's not important that the user be an expert, but they should at least be able to move around and do simple edits. If nothing else, the only commands you need are dd
, and a
. Everything is icing.
Of course, if you spend much time in the editor, the other commands will save a BUNCH of time. But they require more of a time investment up front in order to reap those rewards later.
And if you get good at vi, you can turn on the vi command line editing features in Bash and Ksh (use set -o vi
) allowing you to use the same keystrokes to edit command lines that you use inside your editor. That gives a big boost to productivity...
Most people are told to learn an editor by being given a cheat sheet and being told, "Here. Memorize this." Yeah, great. That's a super way to learn an editor. Not.
All vi commands are "operators" and "operands", except for a few that don't fit the paradigm. Operators specify the manipulations you want to make (delete, insert, change, ...) and operands specify the amount of text to modify (word, sentence, paragraph, ...).
So "d" for delete and "w" for word means to delete one word. This is so simple that a user only needs to learn a half-dozen operators -- I recommend d(elete), i(nsert), a(ppend), c(hange), o(pen), and r(eplace). Then learn a few operands -- h-j-k-l for left-down-up-right, W for next word, E for end of word, B for back one word, and "/" to perform a regex string search. Some commands don't fit the paradigm: u(ndo), .(redo last change), and Ctrl-L (redraw screen). And you will need the ":" commands since they handle all file input and output operations, like reading in other files or saving the current file.
and scroll down to the Downloads
link and click it. Towards the bottom of the next page is a link to my vi cheat sheet which describes this in more detail. Or if you Google for "vi cheat sheet", my page is in the top five or six hits (but it's the EEC.COM domain).