Skip to content

Commit 84a46fe

Browse files
authored
Stop using backspace for remove action; tweak maps (#2202)
This broke when we reworked our keyboard actions setup. It's also not properly integrated with new keyboard parser. If we wanted to support special keys like `backspace` with our keyboard parser, we should define a VSCode command that sends a keyboard token to our parser, and map `backspace` to that We also add `remove` to default config, and tweak some maps while we're there ## Checklist - [-] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent 2fb5d44 commit 84a46fe

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

docs/user/experimental/keyboard/modal.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,12 @@ Paste the following into your [VSCode `keybindings.json`](https://code.visualstu
2929
"key": "escape",
3030
"command": "cursorless.keyboard.escape",
3131
"when": "cursorless.keyboard.listening && editorTextFocus && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
32-
},
33-
{
34-
"key": "backspace",
35-
"command": "cursorless.keyboard.targeted.runActionOnTarget",
36-
"args": "remove",
37-
"when": "cursorless.keyboard.modal.mode && editorTextFocus"
3832
}
3933
```
4034

4135
Any keybindings that use modifier keys should go in `keybindings.json` as well, with a `"when": "cursorless.keyboard.modal.mode` clause.
4236

43-
The above allows you to press `ctrl-c` to switch to Cursorless mode, `escape` to exit Cursorless mode, and `backspace` to issue the delete action while in Cursorless mode.
37+
The above allows you to press `ctrl-c` to switch to Cursorless mode and `escape` to exit Cursorless mode.
4438

4539
If you're already in Cursorless mode, pressing `ctrl-c` again will target the current selection, which is useful if you have moved the cursor using your mouse while in Cursorless mode, and want to target your new cursor position.
4640

@@ -86,7 +80,8 @@ To bind keys that do not have modifiers (eg just pressing `a`), add entries like
8680
"ac": "copyToClipboard",
8781
"ax": "cutToClipboard",
8882
"ap": "pasteFromClipboard",
89-
"ad": "followLink"
83+
"ad": "followLink",
84+
"aw": "remove",
9085
},
9186
"cursorless.experimental.keyboard.modal.keybindings.color": {
9287
"d": "default",

packages/cursorless-vscode-e2e/src/suite/keyboard/basic.vscode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const testCases: TestCase[] = [
3131
name: "every",
3232
initialContent: "a a\nb b\n",
3333
// change every token air
34-
keySequence: ["da", "x", "st", "c"],
34+
keySequence: ["da", "*", "st", "c"],
3535
finalContent: " \nb b\n",
3636
},
3737
{

packages/cursorless-vscode/src/keyboard/keyboard-config.fixture.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,25 @@
2020
},
2121
"cursorless.experimental.keyboard.modal.keybindings.action": {
2222
"at": "setSelection",
23-
"ah": { "actionId": "setSelectionBefore", "exitCursorlessMode": true },
24-
"al": { "actionId": "setSelectionAfter", "exitCursorlessMode": true },
25-
"aO": { "actionId": "editNewLineBefore", "exitCursorlessMode": true },
23+
"ah": "setSelectionBefore",
24+
"al": "setSelectionAfter",
25+
"ai": { "actionId": "editNewLineBefore", "exitCursorlessMode": true },
2626
"ao": { "actionId": "editNewLineAfter", "exitCursorlessMode": true },
27-
"k": "insertCopyBefore",
28-
"j": "insertCopyAfter",
27+
"ak": "insertCopyBefore",
28+
"aj": "insertCopyAfter",
2929
"au": "replaceWithTarget",
3030
"am": "moveToTarget",
3131
"c": { "actionId": "clearAndSetSelection", "exitCursorlessMode": true },
3232
"as": "swapTargets",
3333
"af": "foldRegion",
34-
"ak": "insertEmptyLineBefore",
35-
"aj": "insertEmptyLineAfter",
36-
"ai": "insertEmptyLinesAround",
34+
"aI": "insertEmptyLineBefore",
35+
"aO": "insertEmptyLineAfter",
36+
"aU": "insertEmptyLinesAround",
3737
"ac": "copyToClipboard",
3838
"ax": "cutToClipboard",
3939
"ap": "pasteFromClipboard",
4040
"ad": "followLink",
41+
"x": "remove",
4142
"aw": "wrap"
4243
},
4344
"cursorless.experimental.keyboard.modal.keybindings.color": {
@@ -66,7 +67,7 @@
6667
},
6768
"cursorless.experimental.keyboard.modal.keybindings.modifier": {
6869
"n": "nextPrev",
69-
"x": "every"
70+
"*": "every"
7071
},
7172
"cursorless.experimental.keyboard.modal.keybindings.vscodeCommand": {
7273
"va": "editor.action.addCommentLine",

0 commit comments

Comments
 (0)