Skip to content

Commit a3e7e26

Browse files
scidominokunal-10-cloud
authored andcommitted
make command names consistent (google-gemini#21907)
1 parent 73ae909 commit a3e7e26

2 files changed

Lines changed: 63 additions & 62 deletions

File tree

docs/reference/keyboard-shortcuts.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,25 @@ available combinations.
106106
| 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` |
107107
| Expand and collapse blocks of content when not in alternate buffer mode. | `Ctrl+O` |
108108
| Expand or collapse a paste placeholder when cursor is over placeholder. | `Ctrl+O` |
109-
| Toggle current background shell visibility. | `Ctrl+B` |
110-
| Toggle background shell list. | `Ctrl+L` |
111-
| Kill the active background shell. | `Ctrl+K` |
112-
| Confirm selection in background shell list. | `Enter` |
113-
| Dismiss background shell list. | `Esc` |
114-
| Move focus from background shell to Gemini. | `Shift+Tab` |
115-
| Move focus from background shell list to Gemini. | `Tab` |
116-
| Show warning when trying to move focus away from background shell. | `Tab` |
117-
| Show warning when trying to move focus away from shell input. | `Tab` |
118109
| Move focus from Gemini to the active shell. | `Tab` |
119110
| Move focus from the shell back to Gemini. | `Shift+Tab` |
120111
| Clear the terminal screen and redraw the UI. | `Ctrl+L` |
121112
| Restart the application. | `R`<br />`Shift+R` |
122113
| Suspend the CLI and move it to the background. | `Ctrl+Z` |
114+
| Show warning when trying to move focus away from shell input. | `Tab` |
115+
116+
#### Background Shell Controls
117+
118+
| Action | Keys |
119+
| ------------------------------------------------------------------ | ----------- |
120+
| Dismiss background shell list. | `Esc` |
121+
| Confirm selection in background shell list. | `Enter` |
122+
| Toggle current background shell visibility. | `Ctrl+B` |
123+
| Toggle background shell list. | `Ctrl+L` |
124+
| Kill the active background shell. | `Ctrl+K` |
125+
| Move focus from background shell to Gemini. | `Shift+Tab` |
126+
| Move focus from background shell list to Gemini. | `Tab` |
127+
| Show warning when trying to move focus away from background shell. | `Tab` |
123128

124129
<!-- KEYBINDINGS-AUTOGEN:END -->
125130

packages/cli/src/ui/key/keyBindings.ts

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,6 @@ export enum Command {
7373
OPEN_EXTERNAL_EDITOR = 'input.openExternalEditor',
7474
PASTE_CLIPBOARD = 'input.paste',
7575

76-
BACKGROUND_SHELL_ESCAPE = 'backgroundShellEscape',
77-
BACKGROUND_SHELL_SELECT = 'backgroundShellSelect',
78-
TOGGLE_BACKGROUND_SHELL = 'toggleBackgroundShell',
79-
TOGGLE_BACKGROUND_SHELL_LIST = 'toggleBackgroundShellList',
80-
KILL_BACKGROUND_SHELL = 'backgroundShell.kill',
81-
UNFOCUS_BACKGROUND_SHELL = 'backgroundShell.unfocus',
82-
UNFOCUS_BACKGROUND_SHELL_LIST = 'backgroundShell.listUnfocus',
83-
SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING = 'backgroundShell.unfocusWarning',
84-
SHOW_SHELL_INPUT_UNFOCUS_WARNING = 'shellInput.unfocusWarning',
85-
8676
// App Controls
8777
SHOW_ERROR_DETAILS = 'app.showErrorDetails',
8878
SHOW_FULL_TODOS = 'app.showFullTodos',
@@ -98,27 +88,28 @@ export enum Command {
9888
CLEAR_SCREEN = 'app.clearScreen',
9989
RESTART_APP = 'app.restart',
10090
SUSPEND_APP = 'app.suspend',
91+
SHOW_SHELL_INPUT_UNFOCUS_WARNING = 'app.showShellUnfocusWarning',
92+
93+
// Background Shell Controls
94+
BACKGROUND_SHELL_ESCAPE = 'background.escape',
95+
BACKGROUND_SHELL_SELECT = 'background.select',
96+
TOGGLE_BACKGROUND_SHELL = 'background.toggle',
97+
TOGGLE_BACKGROUND_SHELL_LIST = 'background.toggleList',
98+
KILL_BACKGROUND_SHELL = 'background.kill',
99+
UNFOCUS_BACKGROUND_SHELL = 'background.unfocus',
100+
UNFOCUS_BACKGROUND_SHELL_LIST = 'background.unfocusList',
101+
SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING = 'background.unfocusWarning',
101102
}
102103

103104
/**
104105
* Data-driven key binding structure for user configuration
105106
*/
106107
export class KeyBinding {
107108
private static readonly VALID_KEYS = new Set([
108-
// Letters & Numbers
109-
...'abcdefghijklmnopqrstuvwxyz0123456789',
110-
// Punctuation
111-
'`',
112-
'-',
113-
'=',
114-
'[',
115-
']',
116-
'\\',
117-
';',
118-
"'",
119-
',',
120-
'.',
121-
'/',
109+
...'abcdefghijklmnopqrstuvwxyz0123456789', // Letters & Numbers
110+
..."`-=[]\\;',./", // Punctuation
111+
...Array.from({ length: 19 }, (_, i) => `f${i + 1}`), // Function Keys
112+
...Array.from({ length: 10 }, (_, i) => `numpad${i}`), // Numpad Numbers
122113
// Navigation & Actions
123114
'left',
124115
'up',
@@ -139,10 +130,6 @@ export class KeyBinding {
139130
'insert',
140131
'numlock',
141132
'scrolllock',
142-
// Function Keys
143-
...Array.from({ length: 19 }, (_, i) => `f${i + 1}`),
144-
// Numpad
145-
...Array.from({ length: 10 }, (_, i) => `numpad${i}`),
146133
'numpad_multiply',
147134
'numpad_add',
148135
'numpad_separator',
@@ -354,22 +341,24 @@ export const defaultKeyBindings: KeyBindingConfig = {
354341
[Command.TOGGLE_COPY_MODE]: [new KeyBinding('ctrl+s')],
355342
[Command.TOGGLE_YOLO]: [new KeyBinding('ctrl+y')],
356343
[Command.CYCLE_APPROVAL_MODE]: [new KeyBinding('shift+tab')],
357-
[Command.TOGGLE_BACKGROUND_SHELL]: [new KeyBinding('ctrl+b')],
358-
[Command.TOGGLE_BACKGROUND_SHELL_LIST]: [new KeyBinding('ctrl+l')],
359-
[Command.KILL_BACKGROUND_SHELL]: [new KeyBinding('ctrl+k')],
360-
[Command.UNFOCUS_BACKGROUND_SHELL]: [new KeyBinding('shift+tab')],
361-
[Command.UNFOCUS_BACKGROUND_SHELL_LIST]: [new KeyBinding('tab')],
362-
[Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]: [new KeyBinding('tab')],
363-
[Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: [new KeyBinding('tab')],
364-
[Command.BACKGROUND_SHELL_SELECT]: [new KeyBinding('enter')],
365-
[Command.BACKGROUND_SHELL_ESCAPE]: [new KeyBinding('escape')],
366344
[Command.SHOW_MORE_LINES]: [new KeyBinding('ctrl+o')],
367345
[Command.EXPAND_PASTE]: [new KeyBinding('ctrl+o')],
368346
[Command.FOCUS_SHELL_INPUT]: [new KeyBinding('tab')],
369347
[Command.UNFOCUS_SHELL_INPUT]: [new KeyBinding('shift+tab')],
370348
[Command.CLEAR_SCREEN]: [new KeyBinding('ctrl+l')],
371349
[Command.RESTART_APP]: [new KeyBinding('r'), new KeyBinding('shift+r')],
372350
[Command.SUSPEND_APP]: [new KeyBinding('ctrl+z')],
351+
[Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: [new KeyBinding('tab')],
352+
353+
// Background Shell Controls
354+
[Command.BACKGROUND_SHELL_ESCAPE]: [new KeyBinding('escape')],
355+
[Command.BACKGROUND_SHELL_SELECT]: [new KeyBinding('enter')],
356+
[Command.TOGGLE_BACKGROUND_SHELL]: [new KeyBinding('ctrl+b')],
357+
[Command.TOGGLE_BACKGROUND_SHELL_LIST]: [new KeyBinding('ctrl+l')],
358+
[Command.KILL_BACKGROUND_SHELL]: [new KeyBinding('ctrl+k')],
359+
[Command.UNFOCUS_BACKGROUND_SHELL]: [new KeyBinding('shift+tab')],
360+
[Command.UNFOCUS_BACKGROUND_SHELL_LIST]: [new KeyBinding('tab')],
361+
[Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]: [new KeyBinding('tab')],
373362
};
374363

375364
interface CommandCategory {
@@ -475,20 +464,25 @@ export const commandCategories: readonly CommandCategory[] = [
475464
Command.CYCLE_APPROVAL_MODE,
476465
Command.SHOW_MORE_LINES,
477466
Command.EXPAND_PASTE,
467+
Command.FOCUS_SHELL_INPUT,
468+
Command.UNFOCUS_SHELL_INPUT,
469+
Command.CLEAR_SCREEN,
470+
Command.RESTART_APP,
471+
Command.SUSPEND_APP,
472+
Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING,
473+
],
474+
},
475+
{
476+
title: 'Background Shell Controls',
477+
commands: [
478+
Command.BACKGROUND_SHELL_ESCAPE,
479+
Command.BACKGROUND_SHELL_SELECT,
478480
Command.TOGGLE_BACKGROUND_SHELL,
479481
Command.TOGGLE_BACKGROUND_SHELL_LIST,
480482
Command.KILL_BACKGROUND_SHELL,
481-
Command.BACKGROUND_SHELL_SELECT,
482-
Command.BACKGROUND_SHELL_ESCAPE,
483483
Command.UNFOCUS_BACKGROUND_SHELL,
484484
Command.UNFOCUS_BACKGROUND_SHELL_LIST,
485485
Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING,
486-
Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING,
487-
Command.FOCUS_SHELL_INPUT,
488-
Command.UNFOCUS_SHELL_INPUT,
489-
Command.CLEAR_SCREEN,
490-
Command.RESTART_APP,
491-
Command.SUSPEND_APP,
492486
],
493487
},
494488
];
@@ -576,9 +570,18 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
576570
'Expand and collapse blocks of content when not in alternate buffer mode.',
577571
[Command.EXPAND_PASTE]:
578572
'Expand or collapse a paste placeholder when cursor is over placeholder.',
573+
[Command.FOCUS_SHELL_INPUT]: 'Move focus from Gemini to the active shell.',
574+
[Command.UNFOCUS_SHELL_INPUT]: 'Move focus from the shell back to Gemini.',
575+
[Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.',
576+
[Command.RESTART_APP]: 'Restart the application.',
577+
[Command.SUSPEND_APP]: 'Suspend the CLI and move it to the background.',
578+
[Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]:
579+
'Show warning when trying to move focus away from shell input.',
580+
581+
// Background Shell Controls
582+
[Command.BACKGROUND_SHELL_ESCAPE]: 'Dismiss background shell list.',
579583
[Command.BACKGROUND_SHELL_SELECT]:
580584
'Confirm selection in background shell list.',
581-
[Command.BACKGROUND_SHELL_ESCAPE]: 'Dismiss background shell list.',
582585
[Command.TOGGLE_BACKGROUND_SHELL]:
583586
'Toggle current background shell visibility.',
584587
[Command.TOGGLE_BACKGROUND_SHELL_LIST]: 'Toggle background shell list.',
@@ -589,11 +592,4 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
589592
'Move focus from background shell list to Gemini.',
590593
[Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING]:
591594
'Show warning when trying to move focus away from background shell.',
592-
[Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]:
593-
'Show warning when trying to move focus away from shell input.',
594-
[Command.FOCUS_SHELL_INPUT]: 'Move focus from Gemini to the active shell.',
595-
[Command.UNFOCUS_SHELL_INPUT]: 'Move focus from the shell back to Gemini.',
596-
[Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.',
597-
[Command.RESTART_APP]: 'Restart the application.',
598-
[Command.SUSPEND_APP]: 'Suspend the CLI and move it to the background.',
599595
};

0 commit comments

Comments
 (0)