Hi all,
On my textmate 1.5 installation I changed the definition of start and stop markers for the python language definition.
Now I realized that by replacing the original start and stop markers, I lose the ability to fold function definition, which is more annoying than I anticipated. My problem now is that I don't know how to redefine the marker definitions and I am not able to revert the language definition.
Can somebody help me by just sending the original foldingStartMarker / foldingStopMarker definition in the python language definition? That would be really helpful!
Also; How can I define more than one Start/Stop marker?
My current definition looks like this:
foldingStartMarker = '^[^#]*(([^)]*$|{\s*$)|(#){1}(\s)+[0-9]+'; foldingStopMarker = '(^\s*)|^\s*})|(#){1}(\s)+(end)+';
But I would like to have several Start and Stop markers.
Thanks!
On Apr 16, 2013, at 19:38, Martin Batholdy batholdy@googlemail.com wrote:
Now I realized that by replacing the original start and stop markers, I lose the ability to fold function definition, which is more annoying than I anticipated. My problem now is that I don't know how to redefine the marker definitions and I am not able to revert the language definition.
You can always (temporarily) remove your customizations from ~/Library/Application Support/TextMate/Bundles
Can somebody help me by just sending the original foldingStartMarker / foldingStopMarker definition in the python language definition?
From https://github.com/textmate/python.tmbundle/blob/textmate-1.x/Syntaxes/Pytho...
<key>foldingStartMarker</key> <string>^\s*(def|class)\s+([.a-zA-Z0-9_ <]+)\s*(((.*)))?\s*:|{\s*$|(\s*$|[\s*$|^\s*"""(?=.)(?!.*""")</string> <key>foldingStopMarker</key> <string>^\s*$|^\s*}|^\s*]|^\s*)|^\s*"""\s*$</string>
You may want to clone the (1.x branch) of that bundle so that future changes are under version control.
How can I define more than one Start/Stop marker?
Use alternations, i.e.: foldingStartMarker = 'foo|bar'. This will fold on either ‘foo’ or ‘bar’.
You can enable extended mode for regular expressions to have whitespace ignored and comment support, which can be used to make them more readable.
Look e.g. at the HTML folding patterns.