vim tips and tricks


modelines allow you to set variables specific to a file. By default, the first and last five lines are read by vim for variable settings. For example, if you put the following in the last line of a C program, you would get a textwidth of 60 chars when editing that file:

/* vim: tw=60 ts=2: */

The modelines variable sets the number of lines (at the beginning and end of each file) vim checks for initializations.