Highlight python docstrings as comments (vim syntax highlighting)

后端 未结 3 965
梦毁少年i
梦毁少年i 2020-12-15 07:01

Is it possible to modify python.vim (and the corresponding colorscheme file) such that triple-quoted strings right under class and def statements (a.k.a. docstrings) will be

3条回答
  •  忘掉有多难
    2020-12-15 07:47

    The following worked for me:

    syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
    syn region pythonDocstring  start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
    

    Taken from a modified python.vim from here.

提交回复
热议问题