Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #43 - Using abbreviations

Created: March 9, 2001 4:27 Complexity: basic Author: Anonymous Version: 5.7 Karma: 17/14 Imported from: Tip#43

Use the :abbreviate command to define abbreviations.

Abbreviations can save typing, and can improve accuracy, when you need to enter the same text throughout your document. You can also create abbreviations to automatically correct common typing errors (such as changing teh to the).

Examples:

:ab rtfm read the fine manual
Whenever you type 'rtfm' followed by punctuation such as a space or comma, the 'rtfm' will be expanded to 'read the fine manual'. This also happens if you type 'rtfm' then press Esc or Enter.
:ab teh the
Whenever you type the word 'teh', it will be replaced with 'the'.
:ab
List all abbreviations. A flag is shown in the first column: 'i' means the abbreviation will be used in insert mode, 'c' for command-line mode, and '!' for both modes.
:una rtfm
unabbreviate — remove 'rtfm' from the list of abbreviations.
:abc
abclear — remove all abbreviations.

Note: To avoid expansion in insert mode, type Ctrl-V after the last character of the abbreviation (on Windows, type Ctrl-Q instead of Ctrl-V).

References

:help abbreviations

Comments

Advertisement