Skip to content

Commit e71434f

Browse files
authored
feat(cli): add Alt+D for forward word deletion (#19300)
1 parent 8edbbcd commit e71434f

4 files changed

Lines changed: 4 additions & 1 deletion

File tree

docs/cli/keyboard-shortcuts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ available combinations.
3636
| Delete from the cursor to the start of the line. | `Ctrl + U` |
3737
| Clear all text in the input field. | `Ctrl + C` |
3838
| Delete the previous word. | `Ctrl + Backspace`<br />`Alt + Backspace`<br />`Ctrl + W` |
39-
| Delete the next word. | `Ctrl + Delete`<br />`Alt + Delete` |
39+
| Delete the next word. | `Ctrl + Delete`<br />`Alt + Delete`<br />`Alt + D` |
4040
| Delete the character to the left. | `Backspace`<br />`Ctrl + H` |
4141
| Delete the character to the right. | `Delete`<br />`Ctrl + D` |
4242
| Undo the most recent text edit. | `Cmd + Z (no Shift)`<br />`Alt + Z (no Shift)` |

packages/cli/src/config/keyBindings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export const defaultKeyBindings: KeyBindingConfig = {
178178
[Command.DELETE_WORD_FORWARD]: [
179179
{ key: 'delete', ctrl: true },
180180
{ key: 'delete', alt: true },
181+
{ key: 'd', alt: true },
181182
],
182183
[Command.DELETE_CHAR_LEFT]: [{ key: 'backspace' }, { key: 'h', ctrl: true }],
183184
[Command.DELETE_CHAR_RIGHT]: [{ key: 'delete' }, { key: 'd', ctrl: true }],

packages/cli/src/ui/contexts/KeypressContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const MAC_ALT_KEY_CHARACTER_MAP: Record<string, string> = {
141141
'\u00B5': 'm', // "µ" toggle markup view
142142
'\u03A9': 'z', // "Ω" Option+z
143143
'\u00B8': 'Z', // "¸" Option+Shift+z
144+
'\u2202': 'd', // "∂" delete word forward
144145
};
145146

146147
function nonKeyboardEventFilter(

packages/cli/src/ui/keyMatchers.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ describe('keyMatchers', () => {
130130
positive: [
131131
createKey('delete', { ctrl: true }),
132132
createKey('delete', { alt: true }),
133+
createKey('d', { alt: true }),
133134
],
134135
negative: [createKey('delete'), createKey('backspace', { ctrl: true })],
135136
},

0 commit comments

Comments
 (0)