是否可以修改python.vim(以及相应的colorscheme文件),以便在vim下的python语法高亮显示期间,class和def语句(a.k.a.docstrings)下的三重引号字符串作为注释突出显示吗?在
class URLopener:
"""Class to open URLs.
This is a class rather than just a subroutine because we may need
more than one set of global protocol-specific options.
Note -- this is a base class for those who don't want the
automatic handling of errors type 302 (relocated) and 401
(authorization needed)."""
def addheader(self, *args):
"""Add a header to be used by the HTTP interface only
e.g. u.addheader('Accept', 'sound/basic')"""
# sample comment
您可以添加以下行:
到您的~/.vim/after/syntax/Python.vim. 如果此文件不存在,可以创建它。在
PEP257规定对docstring使用“三重双引号”。在docstring中不必包含''triple single quotes''或''single double quotes''。有一个困难,我们有类docstrings、函数docstrings、模块docstrings、属性docstrings和其他docstring。这就是为什么我决定将docstring考虑为以下更容易:
然后:
^{pr2}$您可以在这个脚本中看到示例(search pythonDocString):https://github.com/andbar-ru/python-syntax/blob/master/syntax/python.vim
以下几点对我有用:
从修改后的Python.vim来自here。在
相关问题 更多 >
编程相关推荐