Setting a Language for vim Syntax Highlighting

Setting a Language for vim Syntax Highlighting

VIM Logo
One can force the language for vim syntax highlighting with

:setf language

Examples

For C:

:setf c

For PHP:

:setf php

For XML:

:setf xml

  1. om Says:

    Was looking for precisely this information, thanks.

    I Have some code in files without file extensions, so I need to manually specify the language otherwise there is no highlighting.

  2. James Reuben Knowles Says:

    So did I. :)

    Glad this helped.

  3. DF Says:

    Cheers, just what I needed!

  4. James Reuben Knowles Says:

    Great! You’re welcome. :)

  5. Shannon S. Says:

    Thanks for the info, spot on!

  6. Braden Says:

    Thanks a bunch!

Leave a Reply