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