From 5f6b7c01587f0c46559d392b5ad3bf296960c413 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Wed, 18 Feb 2026 09:19:26 -0800 Subject: [PATCH] feat(cli): add Alt+D for forward word deletion (#19300) --- docs/cli/keyboard-shortcuts.md | 2 +- packages/cli/src/config/keyBindings.ts | 1 + packages/cli/src/ui/contexts/KeypressContext.tsx | 1 + packages/cli/src/ui/keyMatchers.test.ts | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/cli/keyboard-shortcuts.md b/docs/cli/keyboard-shortcuts.md index adc5b12c0a..0117a652a2 100644 --- a/docs/cli/keyboard-shortcuts.md +++ b/docs/cli/keyboard-shortcuts.md @@ -36,7 +36,7 @@ available combinations. | Delete from the cursor to the start of the line. | `Ctrl + U` | | Clear all text in the input field. | `Ctrl + C` | | Delete the previous word. | `Ctrl + Backspace`
`Alt + Backspace`
`Ctrl + W` | -| Delete the next word. | `Ctrl + Delete`
`Alt + Delete` | +| Delete the next word. | `Ctrl + Delete`
`Alt + Delete`
`Alt + D` | | Delete the character to the left. | `Backspace`
`Ctrl + H` | | Delete the character to the right. | `Delete`
`Ctrl + D` | | Undo the most recent text edit. | `Cmd + Z (no Shift)`
`Alt + Z (no Shift)` | diff --git a/packages/cli/src/config/keyBindings.ts b/packages/cli/src/config/keyBindings.ts index 9833af93de..b6b8cb9534 100644 --- a/packages/cli/src/config/keyBindings.ts +++ b/packages/cli/src/config/keyBindings.ts @@ -178,6 +178,7 @@ export const defaultKeyBindings: KeyBindingConfig = { [Command.DELETE_WORD_FORWARD]: [ { key: 'delete', ctrl: true }, { key: 'delete', alt: true }, + { key: 'd', alt: true }, ], [Command.DELETE_CHAR_LEFT]: [{ key: 'backspace' }, { key: 'h', ctrl: true }], [Command.DELETE_CHAR_RIGHT]: [{ key: 'delete' }, { key: 'd', ctrl: true }], diff --git a/packages/cli/src/ui/contexts/KeypressContext.tsx b/packages/cli/src/ui/contexts/KeypressContext.tsx index d31b1e4fbd..217f5182bb 100644 --- a/packages/cli/src/ui/contexts/KeypressContext.tsx +++ b/packages/cli/src/ui/contexts/KeypressContext.tsx @@ -141,6 +141,7 @@ const MAC_ALT_KEY_CHARACTER_MAP: Record = { '\u00B5': 'm', // "µ" toggle markup view '\u03A9': 'z', // "Ω" Option+z '\u00B8': 'Z', // "¸" Option+Shift+z + '\u2202': 'd', // "∂" delete word forward }; function nonKeyboardEventFilter( diff --git a/packages/cli/src/ui/keyMatchers.test.ts b/packages/cli/src/ui/keyMatchers.test.ts index 7a3a077994..b2de83cd8b 100644 --- a/packages/cli/src/ui/keyMatchers.test.ts +++ b/packages/cli/src/ui/keyMatchers.test.ts @@ -130,6 +130,7 @@ describe('keyMatchers', () => { positive: [ createKey('delete', { ctrl: true }), createKey('delete', { alt: true }), + createKey('d', { alt: true }), ], negative: [createKey('delete'), createKey('backspace', { ctrl: true })], },