在TextMate的1.5.10 r1623,你的小箭头,使您可以折叠方法块:如何在TextMate中为Python注释启用块折叠?
不幸的是,如果你有一个多行的Python评论,不承认它,所以你不能把它折叠:
def foo():
"""
How do
I fold
these comments?
"""
print "bar"
TextMate中有这对他们如何定制折叠网站:http://manual.macromates.com/en/navigation_overview#customizing_foldings
...但我并不擅长于正则表达式够做任何事AB出来吧。 TextMate使用Oniguruma正则表达式API,我使用通过GetBundles更新到最新版本的默认Python.tmbundle。
有没有人有如何做到这一点的想法?在此先感谢您的帮助! :)
添加默认foldingStartMarker
和Python语言在包编辑器下Python.tmbundle foldingStopMarker
正则表达式的值:
foldingStartMarker = '^\s*(def|class)\s+([.a-zA-Z0-9_ <]+)\s*(\((.*)\))?\s*:|\{\s*$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""")';
foldingStopMarker = '^\s*$|^\s*\}|^\s*\]|^\s*\)|^\s*"""\s*$';
这不应该是将foldingStartMarker和foldingStopMarker定义为`“”“|'''`吗? – delnan 2011-01-09 03:30:46
@delnan,我认为你在正确的轨道上。当前的正则表达式值有点复杂将它们添加到上面的问题中) – 2011-01-09 14:53:28