|
| 1 | +[ |
| 2 | + // Auto-pair asterisks |
| 3 | + { |
| 4 | + "keys": ["*"], |
| 5 | + "command": "insert_snippet", |
| 6 | + "args": {"contents": "*${0:$SELECTION}*"}, |
| 7 | + "context": [ |
| 8 | + { "key": "setting.auto_match_enabled"}, |
| 9 | + { "key": "selection_empty", "operand": false, "match_all": true }, |
| 10 | + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "keys": ["backspace"], |
| 15 | + "command": "run_macro_file", |
| 16 | + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, |
| 17 | + "context": [ |
| 18 | + { "key": "setting.auto_match_enabled" }, |
| 19 | + { "key": "selection_empty", "match_all": true }, |
| 20 | + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, |
| 21 | + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true }, |
| 22 | + { "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true } |
| 23 | + ] |
| 24 | + }, |
| 25 | + |
| 26 | + // Auto-pair colon |
| 27 | + { |
| 28 | + "keys": [":"], |
| 29 | + "command": "insert_snippet", |
| 30 | + "args": {"contents": ":${0:$SELECTION}:"}, |
| 31 | + "context": [ |
| 32 | + { "key": "setting.auto_match_enabled"}, |
| 33 | + { "key": "selection_empty", "operand": false, "match_all": true }, |
| 34 | + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "keys": ["backspace"], |
| 39 | + "command": "run_macro_file", |
| 40 | + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, |
| 41 | + "context": [ |
| 42 | + { "key": "setting.auto_match_enabled" }, |
| 43 | + { "key": "selection_empty", "match_all": true }, |
| 44 | + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, |
| 45 | + { "key": "preceding_text", "operator": "regex_contains", "operand": ":$", "match_all": true }, |
| 46 | + { "key": "following_text", "operator": "regex_contains", "operand": "^:", "match_all": true } |
| 47 | + ] |
| 48 | + }, |
| 49 | + |
| 50 | + // Auto-pair underscore |
| 51 | + { |
| 52 | + "keys": ["_"], |
| 53 | + "command": "insert_snippet", |
| 54 | + "args": {"contents": "_${0:$SELECTION}_"}, |
| 55 | + "context": [ |
| 56 | + { "key": "setting.auto_match_enabled"}, |
| 57 | + { "key": "selection_empty", "operand": false, "match_all": true }, |
| 58 | + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "keys": ["backspace"], |
| 63 | + "command": "run_macro_file", |
| 64 | + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, |
| 65 | + "context": [ |
| 66 | + { "key": "setting.auto_match_enabled" }, |
| 67 | + { "key": "selection_empty", "match_all": true }, |
| 68 | + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, |
| 69 | + { "key": "preceding_text", "operator": "regex_contains", "operand": "_$", "match_all": true }, |
| 70 | + { "key": "following_text", "operator": "regex_contains", "operand": "^_", "match_all": true } |
| 71 | + ] |
| 72 | + }, |
| 73 | + |
| 74 | + // Auto-pair backticks |
| 75 | + { |
| 76 | + "keys": ["`"], |
| 77 | + "command": "insert_snippet", |
| 78 | + "args": {"contents": "`$0`"}, |
| 79 | + "context": [ |
| 80 | + { "key": "setting.auto_match_enabled"}, |
| 81 | + { "key": "selection_empty", "match_all": true }, |
| 82 | + { "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" }, |
| 83 | + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\\w`]$", "match_all": true }, |
| 84 | + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|\\.|,|$)", "match_all": true } |
| 85 | + ] |
| 86 | + }, |
| 87 | + { |
| 88 | + "keys": ["`"], |
| 89 | + "command": "insert_snippet", |
| 90 | + "args": {"contents": "`${0:$SELECTION}`"}, |
| 91 | + "context": [ |
| 92 | + { "key": "setting.auto_match_enabled"}, |
| 93 | + { "key": "selection_empty", "operand": false, "match_all": true }, |
| 94 | + { "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" } |
| 95 | + ] |
| 96 | + }, |
| 97 | + { |
| 98 | + "keys": ["`"], |
| 99 | + "command": "move", |
| 100 | + "args": {"by": "characters", "forward": true}, |
| 101 | + "context": [ |
| 102 | + { "key": "setting.auto_match_enabled" }, |
| 103 | + { "key": "selection_empty", "operand": true, "match_all": true }, |
| 104 | + { "key": "selector", "operand": "text.restructuredtext markup.raw.inline - markup.raw.block - text.restructuredtext.embedded" }, |
| 105 | + { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true } |
| 106 | + ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "keys": ["backspace"], |
| 110 | + "command": "run_macro_file", |
| 111 | + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, |
| 112 | + "context": [ |
| 113 | + { "key": "setting.auto_match_enabled" }, |
| 114 | + { "key": "selection_empty", "match_all": true }, |
| 115 | + { "key": "selector", "operator": "equal", "operand": "punctuation.definition.raw.begin.restructuredtext" }, |
| 116 | + { "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true }, |
| 117 | + { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true } |
| 118 | + ] |
| 119 | + } |
| 120 | +] |
0 commit comments