views:

71

answers:

1

I believe there is a method to write a comment in a file that vim will use to override default tabbing and indent values.

Can someone point me to information about this feature and how to use it?

+5  A: 

Per-file settings can be done using "modeline magic".

The basic idea is that you can add a comment to an individual file like this:

/* vim: set tabstop=8:softtabstop=8:shiftwidth=8:noexpandtab */ 

Within vim, you should review:

Tim Henigan
thanks ... only leaving the */ on the same line gives me "E518: Unknown option: */"
Casey
using "vim: set ..." gets rid of the error
Casey
Or you could just use a single-line comment!
Jefromi
Also not that vim will read vi modelines (good if you're changing vi compatible settings, not so useful for softtabstop etc.), and the abbreviated names work also, so you could have `/* vim: se ts=8:sts=8:sw=8:noet */`
Stephen P