突出显示python docstrings作为注释(vim语法高亮)

前端之家收集整理的这篇文章主要介绍了突出显示python docstrings作为注释(vim语法高亮)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
可以修改 python.vim(和相应的colorscheme文件),以便在class和def语句(a.k.a. docstrings)下面的三重引用的字符串将在vim下的Python语法高亮显示时被突出显示为注释?
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

解决方法

您可以添加以下行:
syn region Comment start=/"""/ end=/"""/

到你的〜/ .vim / after / Syntax / python.vim.如果文件不存在,您可以创建此文件.

原文链接:https://www.f2er.com/python/185613.html

猜你在找的Python相关文章