From 5967a3e931aa5a02b22ff5b99a8bc64dc7431a77 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Thu, 19 Sep 2019 23:19:41 -0300 Subject: [PATCH] Created the setting auto_match_enabled_delete Create the `auto_match_enabled_delete` setting https://github.com/SublimeTextIssues/Core/issues 2991 --- Default (Linux).sublime-keymap.hide | 56 ++++++++++++++++++++++++--- Default (OSX).sublime-keymap.hide | 56 ++++++++++++++++++++++++--- Default (Windows).sublime-keymap.hide | 56 ++++++++++++++++++++++++--- Preferences.sublime-settings.hide | 3 ++ 4 files changed, 156 insertions(+), 15 deletions(-) diff --git a/Default (Linux).sublime-keymap.hide b/Default (Linux).sublime-keymap.hide index bc42b6b..4e6b668 100644 --- a/Default (Linux).sublime-keymap.hide +++ b/Default (Linux).sublime-keymap.hide @@ -476,6 +476,52 @@ ] }, + // Disable the default `auto_match_enabled` keybinds on `Default.sublime-package` + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ @@ -505,7 +551,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -543,7 +589,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -576,7 +622,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -607,7 +653,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -646,7 +692,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, diff --git a/Default (OSX).sublime-keymap.hide b/Default (OSX).sublime-keymap.hide index bc42b6b..4e6b668 100644 --- a/Default (OSX).sublime-keymap.hide +++ b/Default (OSX).sublime-keymap.hide @@ -476,6 +476,52 @@ ] }, + // Disable the default `auto_match_enabled` keybinds on `Default.sublime-package` + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ @@ -505,7 +551,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -543,7 +589,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -576,7 +622,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -607,7 +653,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -646,7 +692,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, diff --git a/Default (Windows).sublime-keymap.hide b/Default (Windows).sublime-keymap.hide index bc42b6b..4e6b668 100644 --- a/Default (Windows).sublime-keymap.hide +++ b/Default (Windows).sublime-keymap.hide @@ -476,6 +476,52 @@ ] }, + // Disable the default `auto_match_enabled` keybinds on `Default.sublime-package` + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, + { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + { "keys": ["backspace"], "command": "left_delete", "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 }, + ] + }, + // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ @@ -505,7 +551,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -543,7 +589,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -576,7 +622,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -607,7 +653,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, @@ -646,7 +692,7 @@ }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ - { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "setting.auto_match_enabled_delete", "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 }, diff --git a/Preferences.sublime-settings.hide b/Preferences.sublime-settings.hide index 1e3343a..d61c283 100644 --- a/Preferences.sublime-settings.hide +++ b/Preferences.sublime-settings.hide @@ -145,6 +145,9 @@ // Controls auto pairing of quotes, brackets etc "auto_match_enabled": true, + // Enabled the auto pairing deletion of quotes, brackets etc. + "auto_match_enabled_delete": false, + // Word list to use for spell checking. "dictionary": "Packages/Language - English/en_US.dic",