Saturday, May 13, 2006

VIM note: abbreviations

Command :abbr (:ab) sets abbreviations for strings. For example, with

:abbr #a hello

You could use #a[ENTER] in the INSERT mode to write "hello". This is useful for writing comment.

In my python files, I usually use comment blocks like

#--------------------------------------------
#
# Function header
#
#--------------------------------------------


This could neatly be done by putting some abbr commands to the .vimrc file

Note:
1. You must use # plus one letter for abbreviation names
2. Under windows the vimrc file is _vimrc, and you must make an environment variable VIM.

No comments: