Vim Tips Wiki
Advertisement

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created June 22, 2011 · complexity basic · version 7.0

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:

JohnBeckett 10:51, July 12, 2011 (UTC)

Advertisement