Yeah, it works great in Python, but I was having this problem in C files as well, so I coded up a simple function for use with BracketHighlighter to fold by brackets.
If you happen to use BracketHighlighter, you can create a file called foldbracket.py and drop in this code (I have not yet included it by default in the repo yet)
[code]import bracket_plugin
class fold_bracket(bracket_plugin.BracketPluginCommand):
def run(self, bracket, content, selection):
new_content = [content]
if content.size > 0:
if self.view.fold(content) == False:
new_content = self.view.unfold(content)
self.attr.set_selection(new_content)
[/code]
To map it to a shortcut you can just use this replacing the key sequence with whatever shortcut you would like:
{
"keys": "ctrl+shift+b","ctrl+shift+f"],
"command": "bracket_highlighter_key",
"args":
{
"plugin": {"type": "quote", "tag", "bracket"],"command" : "foldbracket.fold_bracket"}
}
}
But in general I think this should be fixed in the core ST2.
Edit: Removed an unnecessary parameter from the code.