autocomplete - Modify auto_match of quotes, adding an additional quoting character to Sublime Text 2 -
sublime text 2 helpfully closes of quotes.
possible modify characters with?
for example, if add `backticks` list.
@skuroda's answer works great. on mac osx, go
sublime text 2 > preferences > key bindings - user
and paste in text there. make sure wrapped in [...]
(square brackets).
the auto pairing few specialized keybindings. should allow auto pair backticks. should serve guide if want create other auto paired symbols.
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true } ] }, { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$selection}`"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": ["`"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true } ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "packages/default/delete left right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "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 } ] }
simply insert code block user key bindings.
i used default keybinding template, may need further modify of context work perfectly.
Comments
Post a Comment