Vim
can perform syntax highlighting for various file formats. You can enable it with these steps if it’s not currently enabled;
-
Make sure full version of
Vim
with support for syntax highlighting is installed.
-
Manually enable syntax highlighting while in Vim
.
-
Enter command mode by pressing Esc
.
-
Type
:syntax on|off
and press
Enter
.
:syntax on
-
Manually set syntax for file if required.
-
Enter command mode by pressing Esc
-
Type
:set syntax=<filetype>
and press
Enter
.
:set syntax=php
-
To view the list of supported file types, issue
:echo getcompletion
while also in the command mode.
:echo getcompletion('' 'filetype')
-
Permanently enable syntax highlighting by adding :syntax on
in your ~/.vimrc
file.