Changing the default syntax highlighting

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.

In Vim 7.3 the file 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 '''...''' that start on the line following a line ending with a colon can be treated as a comment. To do that, create file python.vim 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 (assuming your vimrc includes commands like filetype indent plugin on and syntax on).

Add the following to file ~/.vim/after/syntax/python.vim (Unix) or $HOME/vimfiles/after/syntax/python.vim (Windows)—you may need to create the directories and the file.