From 077c1a1e2d08f749dc2737b599961d45f1d7fcca Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Tue, 10 Mar 2026 19:15:45 +0000 Subject: [PATCH] make command names consistent (#21907) --- docs/reference/keyboard-shortcuts.md | 23 +++--- packages/cli/src/ui/key/keyBindings.ts | 104 ++++++++++++------------- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/docs/reference/keyboard-shortcuts.md b/docs/reference/keyboard-shortcuts.md index 097b380268..3529ead3ec 100644 --- a/docs/reference/keyboard-shortcuts.md +++ b/docs/reference/keyboard-shortcuts.md @@ -106,20 +106,25 @@ available combinations. | Cycle through approval modes: default (prompt), auto_edit (auto-approve edits), and plan (read-only). Plan mode is skipped when the agent is busy. | `Shift+Tab` | | Expand and collapse blocks of content when not in alternate buffer mode. | `Ctrl+O` | | Expand or collapse a paste placeholder when cursor is over placeholder. | `Ctrl+O` | -| Toggle current background shell visibility. | `Ctrl+B` | -| Toggle background shell list. | `Ctrl+L` | -| Kill the active background shell. | `Ctrl+K` | -| Confirm selection in background shell list. | `Enter` | -| Dismiss background shell list. | `Esc` | -| Move focus from background shell to Gemini. | `Shift+Tab` | -| Move focus from background shell list to Gemini. | `Tab` | -| Show warning when trying to move focus away from background shell. | `Tab` | -| Show warning when trying to move focus away from shell input. | `Tab` | | Move focus from Gemini to the active shell. | `Tab` | | Move focus from the shell back to Gemini. | `Shift+Tab` | | Clear the terminal screen and redraw the UI. | `Ctrl+L` | | Restart the application. | `R`
`Shift+R` | | Suspend the CLI and move it to the background. | `Ctrl+Z` | +| Show warning when trying to move focus away from shell input. | `Tab` | + +#### Background Shell Controls + +| Action | Keys | +| ------------------------------------------------------------------ | ----------- | +| Dismiss background shell list. | `Esc` | +| Confirm selection in background shell list. | `Enter` | +| Toggle current background shell visibility. | `Ctrl+B` | +| Toggle background shell list. | `Ctrl+L` | +| Kill the active background shell. | `Ctrl+K` | +| Move focus from background shell to Gemini. | `Shift+Tab` | +| Move focus from background shell list to Gemini. | `Tab` | +| Show warning when trying to move focus away from background shell. | `Tab` | diff --git a/packages/cli/src/ui/key/keyBindings.ts b/packages/cli/src/ui/key/keyBindings.ts index b375d991c8..5f1e833a53 100644 --- a/packages/cli/src/ui/key/keyBindings.ts +++ b/packages/cli/src/ui/key/keyBindings.ts @@ -73,16 +73,6 @@ export enum Command { OPEN_EXTERNAL_EDITOR = 'input.openExternalEditor', PASTE_CLIPBOARD = 'input.paste', - BACKGROUND_SHELL_ESCAPE = 'backgroundShellEscape', - BACKGROUND_SHELL_SELECT = 'backgroundShellSelect', - TOGGLE_BACKGROUND_SHELL = 'toggleBackgroundShell', - TOGGLE_BACKGROUND_SHELL_LIST = 'toggleBackgroundShellList', - KILL_BACKGROUND_SHELL = 'backgroundShell.kill', - UNFOCUS_BACKGROUND_SHELL = 'backgroundShell.unfocus', - UNFOCUS_BACKGROUND_SHELL_LIST = 'backgroundShell.listUnfocus', - SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING = 'backgroundShell.unfocusWarning', - SHOW_SHELL_INPUT_UNFOCUS_WARNING = 'shellInput.unfocusWarning', - // App Controls SHOW_ERROR_DETAILS = 'app.showErrorDetails', SHOW_FULL_TODOS = 'app.showFullTodos', @@ -98,6 +88,17 @@ export enum Command { CLEAR_SCREEN = 'app.clearScreen', RESTART_APP = 'app.restart', SUSPEND_APP = 'app.suspend', + SHOW_SHELL_INPUT_UNFOCUS_WARNING = 'app.showShellUnfocusWarning', + + // Background Shell Controls + BACKGROUND_SHELL_ESCAPE = 'background.escape', + BACKGROUND_SHELL_SELECT = 'background.select', + TOGGLE_BACKGROUND_SHELL = 'background.toggle', + TOGGLE_BACKGROUND_SHELL_LIST = 'background.toggleList', + KILL_BACKGROUND_SHELL = 'background.kill', + UNFOCUS_BACKGROUND_SHELL = 'background.unfocus', + UNFOCUS_BACKGROUND_SHELL_LIST = 'background.unfocusList', + SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING = 'background.unfocusWarning', } /** @@ -105,20 +106,10 @@ export enum Command { */ export class KeyBinding { private static readonly VALID_KEYS = new Set([ - // Letters & Numbers - ...'abcdefghijklmnopqrstuvwxyz0123456789', - // Punctuation - '`', - '-', - '=', - '[', - ']', - '\\', - ';', - "'", - ',', - '.', - '/', + ...'abcdefghijklmnopqrstuvwxyz0123456789', // Letters & Numbers + ..."`-=[]\\;',./", // Punctuation + ...Array.from({ length: 19 }, (_, i) => `f${i + 1}`), // Function Keys + ...Array.from({ length: 10 }, (_, i) => `numpad${i}`), // Numpad Numbers // Navigation & Actions 'left', 'up', @@ -139,10 +130,6 @@ export class KeyBinding { 'insert', 'numlock', 'scrolllock', - // Function Keys - ...Array.from({ length: 19 }, (_, i) => `f${i + 1}`), - // Numpad - ...Array.from({ length: 10 }, (_, i) => `numpad${i}`), 'numpad_multiply', 'numpad_add', 'numpad_separator', @@ -354,15 +341,6 @@ export const defaultKeyBindings: KeyBindingConfig = { [Command.TOGGLE_COPY_MODE]: [new KeyBinding('ctrl+s')], [Command.TOGGLE_YOLO]: [new KeyBinding('ctrl+y')], [Command.CYCLE_APPROVAL_MODE]: [new KeyBinding('shift+tab')], - [Command.TOGGLE_BACKGROUND_SHELL]: [new KeyBinding('ctrl+b')], - [Command.TOGGLE_BACKGROUND_SHELL_LIST]: [new KeyBinding('ctrl+l')], - [Command.KILL_BACKGROUND_SHELL]: [new KeyBinding('ctrl+k')], - [Command.UNFOCUS_BACKGROUND_SHELL]: [new KeyBinding('shift+tab')], - [Command.UNFOCUS_BACKGROUND_SHELL_LIST]: [new KeyBinding('tab')], - [Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]: [new KeyBinding('tab')], - [Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: [new KeyBinding('tab')], - [Command.BACKGROUND_SHELL_SELECT]: [new KeyBinding('enter')], - [Command.BACKGROUND_SHELL_ESCAPE]: [new KeyBinding('escape')], [Command.SHOW_MORE_LINES]: [new KeyBinding('ctrl+o')], [Command.EXPAND_PASTE]: [new KeyBinding('ctrl+o')], [Command.FOCUS_SHELL_INPUT]: [new KeyBinding('tab')], @@ -370,6 +348,17 @@ export const defaultKeyBindings: KeyBindingConfig = { [Command.CLEAR_SCREEN]: [new KeyBinding('ctrl+l')], [Command.RESTART_APP]: [new KeyBinding('r'), new KeyBinding('shift+r')], [Command.SUSPEND_APP]: [new KeyBinding('ctrl+z')], + [Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: [new KeyBinding('tab')], + + // Background Shell Controls + [Command.BACKGROUND_SHELL_ESCAPE]: [new KeyBinding('escape')], + [Command.BACKGROUND_SHELL_SELECT]: [new KeyBinding('enter')], + [Command.TOGGLE_BACKGROUND_SHELL]: [new KeyBinding('ctrl+b')], + [Command.TOGGLE_BACKGROUND_SHELL_LIST]: [new KeyBinding('ctrl+l')], + [Command.KILL_BACKGROUND_SHELL]: [new KeyBinding('ctrl+k')], + [Command.UNFOCUS_BACKGROUND_SHELL]: [new KeyBinding('shift+tab')], + [Command.UNFOCUS_BACKGROUND_SHELL_LIST]: [new KeyBinding('tab')], + [Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]: [new KeyBinding('tab')], }; interface CommandCategory { @@ -475,20 +464,25 @@ export const commandCategories: readonly CommandCategory[] = [ Command.CYCLE_APPROVAL_MODE, Command.SHOW_MORE_LINES, Command.EXPAND_PASTE, - Command.TOGGLE_BACKGROUND_SHELL, - Command.TOGGLE_BACKGROUND_SHELL_LIST, - Command.KILL_BACKGROUND_SHELL, - Command.BACKGROUND_SHELL_SELECT, - Command.BACKGROUND_SHELL_ESCAPE, - Command.UNFOCUS_BACKGROUND_SHELL, - Command.UNFOCUS_BACKGROUND_SHELL_LIST, - Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING, - Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING, Command.FOCUS_SHELL_INPUT, Command.UNFOCUS_SHELL_INPUT, Command.CLEAR_SCREEN, Command.RESTART_APP, Command.SUSPEND_APP, + Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING, + ], + }, + { + title: 'Background Shell Controls', + commands: [ + Command.BACKGROUND_SHELL_ESCAPE, + Command.BACKGROUND_SHELL_SELECT, + Command.TOGGLE_BACKGROUND_SHELL, + Command.TOGGLE_BACKGROUND_SHELL_LIST, + Command.KILL_BACKGROUND_SHELL, + Command.UNFOCUS_BACKGROUND_SHELL, + Command.UNFOCUS_BACKGROUND_SHELL_LIST, + Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING, ], }, ]; @@ -576,9 +570,18 @@ export const commandDescriptions: Readonly> = { 'Expand and collapse blocks of content when not in alternate buffer mode.', [Command.EXPAND_PASTE]: 'Expand or collapse a paste placeholder when cursor is over placeholder.', + [Command.FOCUS_SHELL_INPUT]: 'Move focus from Gemini to the active shell.', + [Command.UNFOCUS_SHELL_INPUT]: 'Move focus from the shell back to Gemini.', + [Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.', + [Command.RESTART_APP]: 'Restart the application.', + [Command.SUSPEND_APP]: 'Suspend the CLI and move it to the background.', + [Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: + 'Show warning when trying to move focus away from shell input.', + + // Background Shell Controls + [Command.BACKGROUND_SHELL_ESCAPE]: 'Dismiss background shell list.', [Command.BACKGROUND_SHELL_SELECT]: 'Confirm selection in background shell list.', - [Command.BACKGROUND_SHELL_ESCAPE]: 'Dismiss background shell list.', [Command.TOGGLE_BACKGROUND_SHELL]: 'Toggle current background shell visibility.', [Command.TOGGLE_BACKGROUND_SHELL_LIST]: 'Toggle background shell list.', @@ -589,11 +592,4 @@ export const commandDescriptions: Readonly> = { 'Move focus from background shell list to Gemini.', [Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]: 'Show warning when trying to move focus away from background shell.', - [Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: - 'Show warning when trying to move focus away from shell input.', - [Command.FOCUS_SHELL_INPUT]: 'Move focus from Gemini to the active shell.', - [Command.UNFOCUS_SHELL_INPUT]: 'Move focus from the shell back to Gemini.', - [Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.', - [Command.RESTART_APP]: 'Restart the application.', - [Command.SUSPEND_APP]: 'Suspend the CLI and move it to the background.', };