Sublime Forum

Auto-wrap brackets

#1

Since launching of ST3 i was noticed a very neat feature: if you open a curly brace and the next row is already indented, then the next row will be automagically wrapped into brackets. As i said, very, very neat!

However, there are moments when i need to do this on multiple rows of texts, which… doens’t work. At all.

Any idea how to make it to play nice with more lines ?

Thanks!

0 Likes

#2

Default key mapping responsible for that behavior is

	{ "keys": "{"], "command": "wrap_block", "args": {"begin": "{", "end": "}"}, "context":
		
			{ "key": "indented_block", "match_all": true },
			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
			{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true },
		]
	}

in particular the line with “indented_block”.
Maybe it’s worth looking into Default/block.py to try and figure out why the indented_block check works the way it does.

0 Likes