Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).
Python doc is in function body in triple-quoted string. But it is still comment, so with help from Mirek Ruzicka, i wrote syn region to python.vim syntax file.
New lines in python.vim file
Write this lines after pythonRawString region definition to your python.vim file if you want colorize python doc string as comments.
syn region pythonComment
\ start=+\(:\n[\t ]*\)\@<=\z('''\|"""\)+ end=+\z1+ keepend
\ contains=pythonEscape,pythonTodo,@Spell
Comments
I think this is proposing a change to vim73/syntax/python.vim which is not a good idea (should not change files distributed with Vim as updates will wipe out changes). The current syntax file regards """...""" Python doc strings as strings (and colours them accordingly). I gather this tip changes that to comments. I wonder if that is possible in an after/syntax/python.vim file?
These tips are vaguely related:
- 969 Highlight simple Python syntax errors
- 1120 Remove annoyance with syntax highlighting when starting a string
JohnBeckett 10:51, July 12, 2011 (UTC)