3

Recently I've come across several files with vim headers in them, and I have been unable to locate the source of what they are used for.

As an example:

# vi: set ft=ruby :

I understand that set ft=ruby would set the syntax of the file as ruby syntax highlighted (if you do that sort of thing). Is this a new vim convention, inserted by a plugin, some voodoo from the nether?

1 Answer 1

5

It is called a "modeline" and is part of standard VIM. You can read all about it in the documentation typing:

:help modeline

or look on this vimwiki page

It basically allows you to set options for a specific file that are not (necessarily) included in your vimrc. Most of the times it is much more useful to set specific options per filetype in your .vimrc, but sometimes it can be very powerful to have a per-file option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .