在 TextMate 1.5.10 r1623 中,您会看到允许您折叠方法块的小箭头:
不幸的是,如果你有一个多行的 Python 注释,它不能识别它,所以你不能折叠它:
def foo():
"""
How do
I fold
these comments?
"""
print "bar"
TextMate 在他们的网站上有关于如何自定义折叠的内容:http: //manual.macromates.com/en/navigation_overview#customizing_foldings
...但我对正则表达式的熟练程度不足以对此做任何事情。TextMate 使用Oniguruma正则表达式 API,我使用的是通过 GetBundles 更新到最新版本的默认 Python.tmbundle。
有谁知道如何做到这一点?在此先感谢您的帮助!:)
在 Bundle Editor 中的 Python 语言下添加 Python.tmbundle的默认值foldingStartMarker
和正则表达式值:foldingStopMarker
foldingStartMarker = '^\s*(def|class)\s+([.a-zA-Z0-9_ <]+)\s*(\((.*)\))?\s*:|\{\s*$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""")';
foldingStopMarker = '^\s*$|^\s*\}|^\s*\]|^\s*\)|^\s*"""\s*$';