Friday, December 12, 2008

Setting the Filetype

Vim normally sets the current filetype automatically and very accurately at that. In some cases though, such as when you're starting a file from scratch, it doesn't know the filetype. In these cases, you can set the filetype manually.

:set filetype=perl
:set filetype=php
:set filetype=python



Anonymous said...

Even shorter!

:set ft=perl


:setf perl

graywh said...

Be warned that :setf won't change 'ft' if it has already been set to something else.

Also, if you start a new file with the name and extension you intent to call it, vim will set the filetype for you.

Дож said...

And how can I get the value of filetype? (If it's possible, of course.)

Unknown said...

To see the current filetype:

:set filetype