How to force vim to syntax-highlight a file as html?
:set syntax=html
You can also put this into your .vimrc:
au BufReadPost *.ezt set syntax=html
Take a look at this Vim wikia topic. Some useful tips:
As other answers have mentioned, you can use the vim set command to set syntax.
:set syntax=<type>
where<type>
is something likeperl
,html
,php
, etc.There is another mechanism that can be used to control syntax highlighting called
filetype
, orft
for short. Similar to syntax, you give it a type like this::set filetype=html
. Other filetypes areperl
,php
, etc.Sometimes vim "forgets" what syntax to use, especially if you're mixing things like php and html together. Use the keyboard shortcut Ctrl+L (
<C-L>
) to get vim to refresh the highlighting.