|
|
To define a short abbreviation that, when typed, is replaced by
a longer word or phrase, use the ab command. For
example, to define eC as an abbreviation for European
Community, enter the command:
:ab eC European Community
From now on, whenever you type the letters ``eC'' while inserting text, vi will expand them into the phrase ``European Community''. vi waits until you finish inserting text or type <Space> or <Tab> before making the expansion.
Note that the name of the abbreviation cannot contain any space.
It is a bad idea to use a single letter as an abbreviation for a word; every time that letter is typed, it will be replaced. It is also a bad idea to use common two-letter combinations like ``ch'' or ``ee'' or ``th''.
You can prevent an abbreviation from being expanded by escaping the first character following it. For example, the word ``eC'' will not be replaced by ``European Community'' when you type it, if you follow it immediately with a <Ctrl>V (which escapes the next character). (You can insert any control character by pressing <Ctrl>V followed by the control character itself. You can also embed a <Enter> character inside a command line in this way.)
To remove an abbreviation, use the unab command. For
example, to clear the ``eC'' abbreviation, go to command mode and
type:
:unab eC
If you subsequently type the letters ``eC'' they will not be
expanded.
To examine the currently defined abbreviations,
type :ab with no arguments.