Setting a file’s filetype in Vim on the fly

To change the language/file type (and therefore syntax highlighting and features) on the fly in Vim it’s as simple as:

:set filetype=

So for example, for PHP, Java and automatically detecting the language respectively:

:set filetype=php
:set filetype=java
:filetype detect


Published by:


Production Facilitator at Audacious Church Previously Software Developer at UKFast Ltd. and Web Applications Developer at SenseLogix Ltd. Graduate of Renewable Energy BSc from the University of Exeter. Experience with PHP, MySQL, Javascript, CSS and HTML.

Categories General, ProgrammingTags , Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s