< Day Day Up > |
Recipe 6.10. Creating Autotext with Vim's Abbreviations6.10.1 ProblemYou do a lot of repetitious typing, such as copyright statements, code comments, signatures, and so forth, and you would like some kind of auto-text feature. 6.10.2 SolutionUse Vim's abbreviations feature. Abbreviations are created in Normal mode: :ab th This is an example of a Vim abbreviation. To use the abbreviation, switch to Insert mode and type th, followed by any whitespace above (space, tab, or carriage return). To see all of your abbreviations, type: :ab To remove an abbreviation, use: :unabbreviate th To delete all abbreviations, use: :abclear Like everything else in Vim, abbreviations can be preserved forever in ~/.vimrc. 6.10.3 DiscussionYou can use the abbreviation as an automatic spelling-fixer (like Recipe 6.6). Just define your common misspellings as abbrevations. This trick works best for typos (teh for the, for instance). 6.10.4 See Also
|
< Day Day Up > |