- 论坛徽章:
- 0
|
enables you to reverse the order of two words at any time in the
editing session with the single keystroke v.
7.3.3 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 CTRL-V. The keystroke ^V appears in the
map as the ^ character. Characters following the ^V also do not
appear as you expect. For example, a carriage return appears as
^M, escape as ^[, backspace as ^H, and so on.
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 ^A is to type:
:map CTRL-A sequence
There are, however, three control characters that must be escaped
with a ^V. They are ^T, ^W, and ^X. So, for example, if you want to
map ^T, you must type:
:map CTRL-V CTRL-T sequence
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 or a substitution command. For example, the
abbreviation:
:ab 123 one^Mtwo^Mthree
expands to this:
one
two
three
(Here we show the sequence CTRL-V RETURN as ^M, the way it
would appear on your screen.)
You can also globally add lines at certain locations. The command:
:g/^Section/s//As you recall, in^M&/ |
|