diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 58709bc925b..da97038a37c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -20,6 +20,24 @@ "problemMatcher": [], "label": "npm: build: vscode-ide-companion", "detail": "npm run build -w packages/vscode-ide-companion" + }, + { + "label": "npm:docs:keybindings", + "type": "shell", + "command": "npm", + "args": ["run", "docs:keybindings"], + "isBackground": false, + "problemMatcher": [], + "group": "build" + }, + { + "label": "npm:test", + "type": "shell", + "command": "npm", + "args": ["run", "test", "--workspaces"], + "isBackground": false, + "problemMatcher": [], + "group": "test" } ] } diff --git a/docs/reference/keyboard-shortcuts.md b/docs/reference/keyboard-shortcuts.md index 54bc8cc61f5..d351f360528 100644 --- a/docs/reference/keyboard-shortcuts.md +++ b/docs/reference/keyboard-shortcuts.md @@ -65,14 +65,14 @@ available combinations. #### Navigation -| Command | Action | Keys | -| --------------------- | -------------------------------------------------- | --------------- | -| `nav.up` | Move selection up in lists. | `Up` | -| `nav.down` | Move selection down in lists. | `Down` | -| `nav.dialog.up` | Move up within dialog options. | `Up`
`K` | -| `nav.dialog.down` | Move down within dialog options. | `Down`
`J` | -| `nav.dialog.next` | Move to the next item or question in a dialog. | `Tab` | -| `nav.dialog.previous` | Move to the previous item or question in a dialog. | `Shift+Tab` | +| Command | Action | Keys | +| --------------------- | -------------------------------------------------- | ---------------------- | +| `nav.up` | Move selection up in lists. | `Up` | +| `nav.down` | Move selection down in lists. | `Down` | +| `nav.dialog.up` | Move up within dialog options. | `Up`
`K` | +| `nav.dialog.down` | Move down within dialog options. | `Down`
`J` | +| `nav.dialog.next` | Move to the next item or question in a dialog. | `Tab` | +| `nav.dialog.previous` | Move to the previous item or question in a dialog. | `Shift+Tab`
`F10` | #### Suggestions & Completions @@ -97,41 +97,24 @@ available combinations. #### App Controls -| Command | Action | Keys | -| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| `app.showErrorDetails` | Toggle the debug console for detailed error information. | `F12` | -| `app.showFullTodos` | Toggle the full TODO list. | `Ctrl+T` | -| `app.showIdeContextDetail` | Show IDE context details. | `F4` | -| `app.toggleMarkdown` | Toggle Markdown rendering. | `Alt+M` | -| `app.toggleCopyMode` | Toggle copy mode when in alternate buffer mode. | `F9` | -| `app.toggleMouseMode` | Toggle mouse mode (scrolling and clicking). | `Ctrl+S` | -| `app.toggleYolo` | Toggle YOLO (auto-approval) mode for tool calls. | `Ctrl+Y` | -| `app.cycleApprovalMode` | 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` | -| `app.showMoreLines` | Expand and collapse blocks of content when not in alternate buffer mode. | `Ctrl+O` | -| `app.expandPaste` | Expand or collapse a paste placeholder when cursor is over placeholder. | `Ctrl+O` | -| `app.focusShellInput` | Move focus from Gemini to the active shell. | `Tab` | -| `app.unfocusShellInput` | Move focus from the shell back to Gemini. | `Shift+Tab` | -| `app.clearScreen` | Clear the terminal screen and redraw the UI. | `Ctrl+L` | -| `app.restart` | Restart the application. | `R`
`Shift+R` | -| `app.suspend` | Suspend the CLI and move it to the background. | `Ctrl+Z` | -| `app.showShellUnfocusWarning` | Show warning when trying to move focus away from shell input. | `Tab` | -| `app.voiceModePTT` | Hold to speak in Voice Mode. | `Space` | +| `app.showShellUnfocusWarning` | Show warning when trying to move focus away from shell input. | `Tab` | +| `app.voiceModePTT` | Hold to speak in Voice Mode. | `Space` | #### Background Shell Controls -| Command | Action | Keys | -| --------------------------- | ------------------------------------------------------------------ | ----------- | -| `background.escape` | Dismiss background shell list. | `Esc` | -| `background.select` | Confirm selection in background shell list. | `Enter` | -| `background.toggle` | Toggle current background shell visibility. | `Ctrl+B` | -| `background.toggleList` | Toggle background shell list. | `Ctrl+L` | -| `background.kill` | Kill the active background shell. | `Ctrl+K` | -| `background.unfocus` | Move focus from background shell to Gemini. | `Shift+Tab` | -| `background.unfocusList` | Move focus from background shell list to Gemini. | `Tab` | -| `background.unfocusWarning` | Show warning when trying to move focus away from background shell. | `Tab` | -| `app.dumpFrame` | Dump the current frame as a snapshot. | `F8` | -| `app.startRecording` | Start recording the session. | `F6` | -| `app.stopRecording` | Stop recording the session. | `F7` | +| Command | Action | Keys | +| --------------------------- | ------------------------------------------------------------------ | ---------------------- | +| `background.escape` | Dismiss background shell list. | `Esc` | +| `background.select` | Confirm selection in background shell list. | `Enter` | +| `background.toggle` | Toggle current background shell visibility. | `Ctrl+B` | +| `background.toggleList` | Toggle background shell list. | `Ctrl+L` | +| `background.kill` | Kill the active background shell. | `Ctrl+K` | +| `background.unfocus` | Move focus from background shell to Gemini. | `Shift+Tab`
`F10` | +| `background.unfocusList` | Move focus from background shell list to Gemini. | `Tab` | +| `background.unfocusWarning` | Show warning when trying to move focus away from background shell. | `Tab` | +| `app.dumpFrame` | Dump the current frame as a snapshot. | `F8` | +| `app.startRecording` | Start recording the session. | `F6` | +| `app.stopRecording` | Stop recording the session. | `F7` | #### Extension Controls @@ -355,6 +338,6 @@ commands such as `dfx`, `dtx`, `cFx`, and `cTx` are supported. - `shift+enter` is only supported in version 1.25 and higher. - `shift+tab` [is not supported](https://github.com/google-gemini/gemini-cli/issues/20314) - on Node 20 and earlier versions of Node 22. + on Node 20 and earlier versions of Node 22. Use `F10` as a fallback. - On macOS's [Terminal](): - `shift+enter` is not supported. diff --git a/packages/cli/src/ui/key/keyBindings.ts b/packages/cli/src/ui/key/keyBindings.ts index 67e2ff19419..ec18ae7a4dd 100644 --- a/packages/cli/src/ui/key/keyBindings.ts +++ b/packages/cli/src/ui/key/keyBindings.ts @@ -347,7 +347,7 @@ export const defaultKeyBindingConfig: KeyBindingConfig = new Map([ [new KeyBinding('down'), new KeyBinding('j')], ], [Command.DIALOG_NEXT, [new KeyBinding('tab')]], - [Command.DIALOG_PREV, [new KeyBinding('shift+tab')]], + [Command.DIALOG_PREV, [new KeyBinding('shift+tab'), new KeyBinding('f10')]], // Suggestions & Completions [Command.ACCEPT_SUGGESTION, [new KeyBinding('tab'), new KeyBinding('enter')]], @@ -392,11 +392,17 @@ export const defaultKeyBindingConfig: KeyBindingConfig = new Map([ [Command.TOGGLE_COPY_MODE, [new KeyBinding('f9')]], [Command.TOGGLE_MOUSE_MODE, [new KeyBinding('ctrl+s')]], [Command.TOGGLE_YOLO, [new KeyBinding('ctrl+y')]], - [Command.CYCLE_APPROVAL_MODE, [new KeyBinding('shift+tab')]], + [ + Command.CYCLE_APPROVAL_MODE, + [new KeyBinding('shift+tab'), new KeyBinding('f10')], + ], [Command.SHOW_MORE_LINES, [new KeyBinding('ctrl+o')]], [Command.EXPAND_PASTE, [new KeyBinding('ctrl+o')]], [Command.FOCUS_SHELL_INPUT, [new KeyBinding('tab')]], - [Command.UNFOCUS_SHELL_INPUT, [new KeyBinding('shift+tab')]], + [ + Command.UNFOCUS_SHELL_INPUT, + [new KeyBinding('shift+tab'), new KeyBinding('f10')], + ], [Command.CLEAR_SCREEN, [new KeyBinding('ctrl+l')]], [Command.RESTART_APP, [new KeyBinding('r'), new KeyBinding('shift+r')]], [Command.SUSPEND_APP, [new KeyBinding('ctrl+z')]], @@ -409,7 +415,10 @@ export const defaultKeyBindingConfig: KeyBindingConfig = new Map([ [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, + [new KeyBinding('shift+tab'), new KeyBinding('f10')], + ], [Command.UNFOCUS_BACKGROUND_SHELL_LIST, [new KeyBinding('tab')]], [Command.SHOW_BACKGROUND_SHELL_UNFOCUS_WARNING, [new KeyBinding('tab')]], diff --git a/packages/cli/src/ui/key/keyMatchers.test.ts b/packages/cli/src/ui/key/keyMatchers.test.ts index a5f28d8cb79..a4ca6716620 100644 --- a/packages/cli/src/ui/key/keyMatchers.test.ts +++ b/packages/cli/src/ui/key/keyMatchers.test.ts @@ -441,7 +441,22 @@ describe('keyMatchers', () => { }, { command: Command.CYCLE_APPROVAL_MODE, - positive: [createKey('tab', { shift: true })], + positive: [createKey('tab', { shift: true }), createKey('f10')], + negative: [createKey('tab')], + }, + { + command: Command.DIALOG_PREV, + positive: [createKey('tab', { shift: true }), createKey('f10')], + negative: [createKey('tab')], + }, + { + command: Command.UNFOCUS_SHELL_INPUT, + positive: [createKey('tab', { shift: true }), createKey('f10')], + negative: [createKey('tab')], + }, + { + command: Command.UNFOCUS_BACKGROUND_SHELL, + positive: [createKey('tab', { shift: true }), createKey('f10')], negative: [createKey('tab')], }, {