According to :help syntax
, using syntax enable
or syntax on
loads syntax files at runtime. But there's also apparently syntax manual
which turns it on based on the syntax type you specify. Looking at the source vimscript, it says:
It installs the Syntax autocommands, but not the FileType autocommands.
You can therefore use syntax=
to set the type, and that works in a modeline to either set a specific type or set none
which effectively turns it off.
# vimrc
syntax manual
# In your files
# Turn it on for this yaml file
# vim: syntax=yaml:
# Or this PHP file
# vim: syntax=php:
If you want to be explicit about disabling it in a file:
# In your files
# No syntax highlighting for this file (default if omitted)
# vim: syntax=none: