advertisement
! teh the
The "i" in the first column indicates Insert mode. These abbreviations are
only active in Insert mode. Other possible characters are:
c Command-line mode :cabbrev
! both Insert and Command-line mode :abbreviate
Since abbreviations are not often useful in Command-line mode, you will mostly
use the ":iabbrev" command. That avoids, for example, that "ad" gets expanded
when typing a command like: >
:edit ad
DELETING ABBREVIATIONS
To get rid of an abbreviation, use the ":unabbreviate" command. Suppose you
have the following abbreviation: >
:abbreviate @f fresh
You can remove it with this command: >
:unabbreviate @f
While you type this, you will notice that @f is expanded to "fresh". Don't
worry about this, Vim understands it anyway (except when you have an
abbreviation for "fresh", but that's very unlikely).
To remove all the abbreviations: >
:abclear
":unabbreviate" and ":abclear" also come in the variants for Insert mode
(":iunabbreviate and ":iabclear") and Command-line mode (":cunabbreviate" and
":cabclear").
REMAPPING ABBREVIATIONS
There is one thing to watch out for when defining an abbreviation: The
resulting string should not be mapped. For example: >
:abbreviate @a adder
:imap dd disk-door
When you now type @a, you will get "adisk-doorer". That's not what you want.
To avoid this, use the ":noreabbrev" command. It does the same as
":abbreviate", but avoids that the resulting string is used for mappings: >
:noreabbrev @a adder
Fortunately, it's unlikely that the result of an abbreviation is mapped.
==============================================================================
*24.8* Entering special characters
The CTRL-V command is used to insert the next character literally. In other
words, any special meaning the character has, it will be ignored. For
example: >
CTRL-V <Esc>
Inserts an escape character. Thus you don't leave Insert mode. (Don't type
the space after CTRL-V, it's only to make this easier to read).
Note:
On MS-Windows CTRL-V is used to paste text. Use CTRL-Q instead of
CTRL-V. On Unix, on the other hand, CTRL-Q does not work on some
terminals, because it has a special meaning.
You can also use the command CTRL-V {digits} to insert a character with the
decimal number {digits}. For example, the character number 127 is the <Del>
character (but not necessarily the <Del> key!). To insert <Del> type: >
CTRL-V 127
You can enter characters up to 255 this way. When you type fewer than two
digits, a non-digit will terminate the command. To avoid the need of typing a
non-digit, prepend one or two zeros to make three digits.
All the next commands insert a <Tab> and then a dot:
CTRL-V 9.
CTRL-V 09.
CTRL-V 009.
To enter a character in hexadecimal, use an "x" after the CTRL-V: >
CTRL-V x7f
This also goes up to character 255 (CTRL-V xff).