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:

  1. Make sure full version of Vim with support for syntax highlighting is installed.
  2. Enter command mode by pressing Esc.
  3. Type :syntax on|off and press Enter.
    :syntax on

  4. Enter command mode again by pressing Esc
  5. Type :set syntax=<filetype> and press Enter manually set syntax for specific file type if required.
    :set syntax=php

  6. View the list of supported file types while also in the command mode.
    :echo getcompletion(// 'filetype')

  7. Permanently enable syntax highlighting by adding :syntax on in your ~/.vimrc file.
Discuss the article:

Comment anonymously. Login not required.