Sublime Forum

Bind newline macro with semicolon

#1

Hello,
I want bind a ctrl+enter macro, that in C++, PHP and javascript adds at the end of line semicon and creates new line under the current line. But I don’t want this behave in HTML. Is it possible?

0 Likes

#2

If you can define the scope selector properly I don’t see why not. Here is an example of the close tag feature in ST3.

	{ "keys": "/"], "command": "close_tag", "args": { "insert_slash": true }, "context":
		
			{ "key": "selector", "operator": "equal", "operand": "text.html, text.xml", "match_all": true },
			{ "key": "preceding_text", "operator": "regex_match", "operand": ".*<$", "match_all": true },
			{ "key": "setting.auto_close_tags" }
		]
	}

What you really care about in this example is the “selector” key in “context”.

0 Likes