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