Creating Custom Commands in vi
Back in the old days (when bread cost five cents and my grandfather was
just a boy...) a terminal's arrow keys didn't work during
To move around in the file, you pressed ESC and used command-mode
Since then, lots of vendors and users have modified
you can use arrow keys during text-input mode.
In fact, we show you how to do it yourself in articles
These days, lots of folks think the newfangled way that
is the right way.
Here are some reasons to leave the arrow keys alone
and do it the old way instead:
In most cases, the
(undo) command will be useless after text-input
mode because the arrow keymap does several hidden commands.
The only "undo" command that will do much good is
-it undoes all
changes on the current line, and it doesn't work if you've moved off the
line since you made the change you want to undo.
Beginners can get confused by this.
They need to learn that
is a moded editor, that you enter text
in text-input mode and make changes in command mode.
Movement through the file is with commands.
When people start using
and they find that some motion commands
(the cursor keys) work in text-input mode,
runs commands that start with an ESC (and it almost
always will), your ESC key may work more slowly.
That's because every time you press the ESC key,
will wait one
second (or so) to be sure that the ESC is just an ESC alone and not the
beginning of a
Some vendors have changed this, though.
The fast alternative is to press ESC twice.
That rings the terminal bell, though.