Vim Tips Wiki

Changing the default syntax highlighting

Revision as of 15:25, March 8, 2013 by (Talk)

1,619pages on
this wiki

Headline text Vim provides syntax files that can provide syntax coloring or folding for certain types of files. This tip discusses how to change some features of the standard syntax files to suit a personal preference. Do not change any of the files distributed with Vim because such updates will be lost when Vim is updated. Instead, use the techniques discussed here.


Here are some pointers to the Vim documentation on syntax highlighting.

  • I want files to be highlighted like HTML files:
  • I want to define a syntax file for <code> Read the above and also
  • I want to make a few changes to the existing syntax highlighting:
  • I want to change some of the colors from their defaults.

Python triple-quoted comments

In Vim 7.3 the file <code>vim73/syntax/python.vim provides syntax highlighting for Python files. That file (correctly) treats as a string and highlights it accordingly. If you prefer, instances of or <code> that start on the line following a line ending with a colon can be treated as a comment. To do that, create file <code>python.vim<code> in your after syntax directory as in the following. The next Python file you open should treat triple-quoted doc strings in functions as comments includes commands like <code>filetype and <code>syntax on<code>

Around Wikia's network

Random Wiki