:ab abbr phrase
abbr is an abbreviation for the specified
phrase. The sequence of characters that make up
the abbreviation will be expanded during text-input mode only if you
type it as a full word; abbr will not be
expanded within a word. [I abbreviate Covnex to
Convex, my company's name, because I have
dyslexic fingers. -- TC]
Suppose you want to enter text that contains a frequently occuring
phrase, such as a difficult product or company name. The command:
:ab ns the Nutshell Handbook
abbreviates the Nutshell Handbook to the
initials ns. Now whenever you type
ns as a separate word during text-input mode,
ns expands to the full text.
:unab abbr
To list your currently defined abbreviations, type:
:ab
The characters that compose your abbreviation cannot appear at the
end of your phrase. For example, if you issue the command:
:ab PG This movie is rated PG
you'll get the message No tail recursion, and the
abbreviation won't be set. The message means that you have tried to
define something that will expand itself repeatedly, creating an
infinite loop. If you issue the command:
:ab PG the PG rating system
you may or may not produce an infinite loop, but in either case you
won't get a warning message. For example, when the previous command
was tested on a System V version of Unix, the expansion worked. On a
Berkeley version, though, the abbreviation expanded repeatedly, like
this:
the the the the the ...
until a memory error occurred and vi quit. We
recommend that you avoid repeating your abbreviation as part of the
defined phrase.
--DD and DG, from Learning the vi Editor
(O'Reilly, 1998)
 |  |  |
17.22. vi Compound Searches |  | 17.24. Using vi Abbreviations as Commands |