Using sublime text. Similar to how when you add a new bracket { and hit enter, it creates a new indented block like so (the .... are spaces):
{
....
}
I would like the same thing to happen when I use backticks (since I'm using stlyed-components).
So when I input `+enter, I would get:
`
....
`
How do I do that?
You'll need a new keybinding for Enter, with specific conditions. Open Preferences → Key Bindings
and add the following to the right side:
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
]
},
This will only run if you have the "auto_indent"
setting on, the selection is empty, and the characters immediately before and after the cursor are backticks.