vim gvim syntax coloring bug with """docstrings"""

Trent Mick trentm at
Fri Aug 9 18:09:53 CEST 2002

[Will Stuyvesant wrote]
> """So you want to document things huh?
> When source files get bigger and you put a big docstring at the top
> gvim (and vim) makes a mess of the syntax coloring, making mistakes
> all over the file in what is code and what are comments.  Does anybody
> have a good .vimrc file that does not have this problem?  Or a
> python.vim file that you can just paste into the .vimrc?
> """
> also using ''' instead of """ does not help :-)

The following is in the python.vim that comes with Vim 6.1:

    " This is fast but code inside triple quoted strings screws it up. It
    " is impossible to fix because the only way to know if you are inside a
    " triple quoted string is to start from the beginning of the file. If
    " you have a fast machine you can try uncommenting the "sync minlines"
    " and commenting out the rest.
    syn sync match pythonSync grouphere NONE "):$"
    syn sync maxlines=200
    "syn sync minlines=2000

You should be able to muck with those lines to get syntax coloring to
work properly.


Trent Mick
TrentM at

More information about the Python-list mailing list