Tip #331: modline magic...
tip karma |
Rating 16/9, Viewed by 994
|
created: |
|
September 22, 2002 14:35 |
|
complexity: |
|
basic |
author: |
|
Alex A. Naanou |
|
as of Vim: |
|
5.7 |
One of the things about vim that are both quite simple yet very
useful is that you can store by-file settings... that is each file can
contain settings specific to it. this thing is called a modline (:help
modline). though this is limited to only the 'set' command arguments,
you can do allot of local to file things like the indent type, folding
method and so on.
the syntax is as follows:
// vim:set ts=4 sw=4 nowrap:
or
/* vim:noai:ts=2:sw=4: */
The modlines can be contained in comments so as to not interfere with
the file syntax (shown here for C/C++). these lines are read by vim
when it loads the file, and they can either be in the first or last 5
lines (by default).
refer to ':help modline'
//and a happy 20th birthday to the good old smiley!! :-)
<<how to stop auto indenting |
make footnotes in vim >>
Additional Notes
|