Skip to content

Commit 7390bf7

Browse files
committed
Improve folding settings
Don't mark lines that both end and start a block as completing a fold, example: ```perl if ($foo eq 'bar') { } elsif ($baz > 8) { } else { } ``` Also now allow comments to follow the opening of a `{}` group.
1 parent 80826ab commit 7390bf7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Preferences/Folding.tmPreferences

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
<key>settings</key>
1010
<dict>
1111
<key>foldingStartMarker</key>
12-
<string>((\{|\[|\()\s*$)</string>
12+
<string>(?x)
13+
^ \s* (?![\s}]) .* # Ensure a block doesnt both start and end on the line
14+
\{ \s* ($|\#) # Open block
15+
| (\[|\() \s* ($|\#)
16+
</string>
1317
<key>foldingStopMarker</key>
14-
<string>(^\s*(\}|\]|\)))</string>
18+
<string>(?x)
19+
^ \s* \} # Close block
20+
(?! .* \{ \s* ($|\#)) # Ensure a block doesnt both start and end on the line
21+
| ^ \s* (\]|\))
22+
</string>
1523
</dict>
1624
<key>uuid</key>
1725
<string>ABBA3E7D-D306-4E27-8DE3-FECBA5C5A6C6</string>

0 commit comments

Comments
 (0)