From b18b5aac298f04f978cb4638ad0893b98b7f4a49 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Tue, 9 Dec 2025 18:17:02 -0500 Subject: [PATCH 1/2] Add keymap to help writing herestrings Fixes #203 --- Default.sublime-keymap | 126 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 Default.sublime-keymap diff --git a/Default.sublime-keymap b/Default.sublime-keymap new file mode 100644 index 00000000..2f06cde3 --- /dev/null +++ b/Default.sublime-keymap @@ -0,0 +1,126 @@ +[ + { + "keys": ["\""], + "command": "chain", + "args": { + "commands": [{ + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, + }, { + "command": "move", + "args": {"by": "characters", "forward": true}, + }, { + "command": "insert", + "args": {"characters": "@" }, + }], + }, + "context": [ + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "string.quoted.double.powershell", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@\"", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "\"(?!@)", "match_all": true } + ] + }, + { + "keys": ["'"], + "command": "chain", + "args": { + "commands": [{ + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, + }, { + "command": "move", + "args": {"by": "characters", "forward": true}, + }, { + "command": "insert", + "args": {"characters": "@" }, + }], + }, + "context": [ + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "string.quoted.single.powershell", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@'", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "'(?!@)", "match_all": true } + ] + }, + { + "keys": ["enter"], + "command": "chain", + "args": { + "commands": [{ + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, + }, { + "command": "move", + "args": {"by": "characters", "forward": true}, + }, { + "command": "insert", + "args": {"characters": "@" }, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }, { + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }], + }, + "context": [ + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "string.quoted.double.powershell", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@\"", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "\"(?!@)", "match_all": true } + ] + }, + { + "keys": ["enter"], + "command": "chain", + "args": { + "commands": [{ + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, + }, { + "command": "move", + "args": {"by": "characters", "forward": true}, + }, { + "command": "insert", + "args": {"characters": "@" }, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }, { + "command": "insert", + "args": {"characters": "\n" }, + }, { + "command": "move", + "args": {"by": "characters", "forward": false}, + }], + }, + "context": [ + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "string.quoted.single.powershell", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@'", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "'(?!@)", "match_all": true } + ] + }, +] From a5c7e7ed5167661be4bea4b4edd6e1afc3e1baa2 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Tue, 9 Dec 2025 18:33:14 -0500 Subject: [PATCH 2/2] Use a better macro for herestring help --- Default.sublime-keymap | 82 +++++------------------------------------- 1 file changed, 9 insertions(+), 73 deletions(-) diff --git a/Default.sublime-keymap b/Default.sublime-keymap index 2f06cde3..fe5fc622 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -5,75 +5,19 @@ "args": { "commands": [{ "command": "insert", - "args": {"characters": "\n" }, + "args": {"characters": "\"\n" }, }, { "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, }, { - "command": "move", - "args": {"by": "characters", "forward": true}, - }, { - "command": "insert", - "args": {"characters": "@" }, - }], - }, - "context": [ - { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "string.quoted.double.powershell", "match_all": true }, - { "key": "preceding_text", "operator": "regex_contains", "operand": "@\"", "match_all": true }, - { "key": "following_text", "operator": "regex_contains", "operand": "\"(?!@)", "match_all": true } - ] - }, - { - "keys": ["'"], - "command": "chain", - "args": { - "commands": [{ - "command": "insert", - "args": {"characters": "\n" }, - }, { - "command": "run_macro_file", - "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, - }, { - "command": "move", - "args": {"by": "characters", "forward": true}, - }, { - "command": "insert", - "args": {"characters": "@" }, - }], - }, - "context": [ - { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "string.quoted.single.powershell", "match_all": true }, - { "key": "preceding_text", "operator": "regex_contains", "operand": "@'", "match_all": true }, - { "key": "following_text", "operator": "regex_contains", "operand": "'(?!@)", "match_all": true } - ] - }, - { - "keys": ["enter"], - "command": "chain", - "args": { - "commands": [{ "command": "insert", - "args": {"characters": "\n" }, - }, { - "command": "run_macro_file", - "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, - }, { - "command": "move", - "args": {"by": "characters", "forward": true}, - }, { - "command": "insert", - "args": {"characters": "@" }, + "args": {"characters": "\"@" }, }, { "command": "move", "args": {"by": "characters", "forward": false}, }, { "command": "move", "args": {"by": "characters", "forward": false}, - }, { - "command": "insert", - "args": {"characters": "\n" }, }, { "command": "move", "args": {"by": "characters", "forward": false}, @@ -81,36 +25,29 @@ }, "context": [ { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "string.quoted.double.powershell", "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", "operand": "source.powershell - string", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@", "match_all": true }, ] }, { - "keys": ["enter"], + "keys": ["'"], "command": "chain", "args": { "commands": [{ "command": "insert", - "args": {"characters": "\n" }, + "args": {"characters": "'\n" }, }, { "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"}, - }, { - "command": "move", - "args": {"by": "characters", "forward": true}, }, { "command": "insert", - "args": {"characters": "@" }, + "args": {"characters": "'@" }, }, { "command": "move", "args": {"by": "characters", "forward": false}, }, { "command": "move", "args": {"by": "characters", "forward": false}, - }, { - "command": "insert", - "args": {"characters": "\n" }, }, { "command": "move", "args": {"by": "characters", "forward": false}, @@ -118,9 +55,8 @@ }, "context": [ { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "string.quoted.single.powershell", "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", "operand": "source.powershell - string", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@", "match_all": true }, ] }, ]