Quantcast
Image

Search Results for: install-vim

How to enable syntax highlighting in Vim

By  •  May 28, 2023

Vim can perform syntax highlighting for various file formats. You can enable it with these steps if it’s not currently enabled;

  1. Make sure full version of Vim with support for syntax highlighting is installed.

  2. Manually enable syntax highlighting while in Vim.
    1. Enter command mode by pressing Esc.
    2. Type :syntax on|off and press Enter.

      :syntax on
  3. Manually set syntax for file if required.
    1. Enter command mode by pressing Esc
    2. Type :set syntax=<filetype> and press Enter.

      :set syntax=php
    3. To view the list of supported file types, issue :echo getcompletion while also in the command mode.

      :echo getcompletion('' 'filetype')
  4. Permanently enable syntax highlighting by adding :syntax on in your ~/.vimrc file.
Top