31.6 Protecting Keys from Interpretation by ex
Note that when defining a map, you cannot simply type certain keys,
such as
RETURN,
ESC,
BACKSPACE,
and
DELETE
as part of the command to be mapped, because
these keys already have meaning within ex
.
If you want to include one of these keys as part of the command
sequence, you must escape the normal meaning
by preceding the key with On the other hand, if you want to use a control character as the
character to be mapped,
in most cases all you have to do is hold down the
CTRL
key and press the letter key at the same time.
So, for example, all you need to do in order to map :map [CTRL-a] There are, however, a few other control characters that must be
escaped with a
So, for example, if you want to map :map [CTRL-v] [CTRL-t] The use of CTRL-v applies to any ex command, not just a map command. This means that you can type a carriage return in an abbreviation (30.31 ) or a substitution command. For example, the abbreviation:
expands to this: one two three (The sequence [CTRL-v]
[RETURN]
is shown as it appears on your screen, You can also add lines globally at certain locations. The command:
inserts a phrase on a separate line before any line beginning with the word
Section
. The
The vertical bar (
If you ask for a list of text-input mode maps, you should see a single stored CTRL-v:
- from O'Reilly & Associates' Learning the vi Editor , Chapter 7 , , |
|