Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"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": "insert",
"args": {"characters": "\"@" },
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}],
},
"context": [
{ "key": "selection_empty", "match_all": true },
{ "key": "selector", "operand": "source.powershell - string", "match_all": true },
{ "key": "preceding_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": "insert",
"args": {"characters": "'@" },
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}],
},
Comment on lines +34 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the following insert_snippet achieve the same?

Suggested change
"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": "insert",
"args": {"characters": "'@" },
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}, {
"command": "move",
"args": {"by": "characters", "forward": false},
}],
},
"command": "insert_snippet",
"args": { "contents": "$0''@"},

Copy link
Collaborator Author

@michaelblyons michaelblyons Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try it when I get to a computer, but I don't think so. The newlines in PS are significant parts of the herestring. Both in the opening and closing.

From this (pipe is caret):

    $foo = @|

The objective is to type " and end with

    $foo = @"
|
"@

no matter what the original indentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just the insert and the three moves could be replaced with an insert_snippet $0\n"@?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the intented behavior happening on my Windows box. Typing ' ends up with @''@, using keybindings from this PR.

Copy link
Collaborator Author

@michaelblyons michaelblyons Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh weird. I really thought I tested this both against master and refactor. And it's not working right (but not in the same way as you have). Luckily, the new PR seems to work.

"context": [
{ "key": "selection_empty", "match_all": true },
{ "key": "selector", "operand": "source.powershell - string", "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "@", "match_all": true },
]
},
]