[ // Auto-pair backquotes. Partially copied from the default Sublime keymap, // with some modifications. { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": [ { "key": "selector", "operator": "equal", "operand": "source.go", }, { "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": "(?:^|\\s)$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\\s|$)", "match_all": true }, ] }, { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context": [ { "key": "selector", "operator": "equal", "operand": "source.go", }, { "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": "selector", "operator": "equal", "operand": "source.go", }, { "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": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "selector", "operator": "equal", "operand": "source.go", }, { "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 }, ] }, // Insert an indented line when pressing Enter between parentheses. { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context": [ { "key": "selector", "operator": "equal", "operand": "source.go", }, { "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 }, ] }, ]