Improve key binding names and descriptions (#16529)

This commit is contained in:
Tommaso Sciortino
2026-01-13 12:07:55 -08:00
committed by GitHub
parent 91fcca3b1c
commit e931ebe581
5 changed files with 31 additions and 36 deletions

View File

@@ -62,7 +62,7 @@ available combinations.
| Show the previous entry in history. | `Ctrl + P (no Shift)` |
| Show the next entry in history. | `Ctrl + N (no Shift)` |
| Start reverse search through history. | `Ctrl + R` |
| Insert the selected reverse-search match. | `Enter (no Ctrl)` |
| Submit the selected reverse-search match. | `Enter (no Ctrl)` |
| Accept a suggestion while reverse searching. | `Tab` |
#### Navigation
@@ -100,18 +100,18 @@ available combinations.
#### App Controls
| Action | Keys |
| ----------------------------------------------------------------- | ----------------------------------- |
| Toggle detailed error information. | `F12` |
| Toggle the full TODO list. | `Ctrl + T` |
| Toggle IDE context details. | `Ctrl + G` |
| Toggle Markdown rendering. | `Cmd + M` |
| Toggle copy mode when the terminal is using the alternate buffer. | `Ctrl + S` |
| Toggle YOLO (auto-approval) mode for tool calls. | `Ctrl + Y` |
| Toggle Auto Edit (auto-accept edits) mode. | `Shift + Tab` |
| Expand a height-constrained response to show additional lines. | `Ctrl + S` |
| Toggle focus between the shell and Gemini input. | `Tab (no Shift)` |
| Toggle focus out of the interactive shell and into Gemini input. | `Tab (no Shift)`<br />`Shift + Tab` |
| Action | Keys |
| ----------------------------------------------------------------- | ---------------- |
| Toggle detailed error information. | `F12` |
| Toggle the full TODO list. | `Ctrl + T` |
| Show IDE context details. | `Ctrl + G` |
| Toggle Markdown rendering. | `Cmd + M` |
| Toggle copy mode when the terminal is using the alternate buffer. | `Ctrl + S` |
| Toggle YOLO (auto-approval) mode for tool calls. | `Ctrl + Y` |
| Toggle Auto Edit (auto-accept edits) mode. | `Shift + Tab` |
| Expand a height-constrained response to show additional lines. | `Ctrl + S` |
| Focus the shell input from the gemini input. | `Tab (no Shift)` |
| Focus the Gemini input from the shell input. | `Tab` |
#### Session Control

View File

@@ -59,7 +59,7 @@ export enum Command {
// App level bindings
SHOW_ERROR_DETAILS = 'showErrorDetails',
SHOW_FULL_TODOS = 'showFullTodos',
TOGGLE_IDE_CONTEXT_DETAIL = 'toggleIDEContextDetail',
SHOW_IDE_CONTEXT_DETAIL = 'showIDEContextDetail',
TOGGLE_MARKDOWN = 'toggleMarkdown',
TOGGLE_COPY_MODE = 'toggleCopyMode',
TOGGLE_YOLO = 'toggleYolo',
@@ -81,8 +81,8 @@ export enum Command {
REVERSE_SEARCH = 'reverseSearch',
SUBMIT_REVERSE_SEARCH = 'submitReverseSearch',
ACCEPT_SUGGESTION_REVERSE_SEARCH = 'acceptSuggestionReverseSearch',
TOGGLE_SHELL_INPUT_FOCUS_IN = 'toggleShellInputFocus',
TOGGLE_SHELL_INPUT_FOCUS_OUT = 'toggleShellInputFocusOut',
FOCUS_SHELL_INPUT = 'focusShellInput',
UNFOCUS_SHELL_INPUT = 'unfocusShellInput',
// Suggestion expansion
EXPAND_SUGGESTION = 'expandSuggestion',
@@ -243,7 +243,7 @@ export const defaultKeyBindings: KeyBindingConfig = {
// App level bindings
[Command.SHOW_ERROR_DETAILS]: [{ key: 'f12' }],
[Command.SHOW_FULL_TODOS]: [{ key: 't', ctrl: true }],
[Command.TOGGLE_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }],
[Command.SHOW_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }],
[Command.TOGGLE_MARKDOWN]: [{ key: 'm', command: true }],
[Command.TOGGLE_COPY_MODE]: [{ key: 's', ctrl: true }],
[Command.TOGGLE_YOLO]: [{ key: 'y', ctrl: true }],
@@ -259,11 +259,8 @@ export const defaultKeyBindings: KeyBindingConfig = {
// Note: original logic ONLY checked ctrl=false, ignored meta/shift/paste
[Command.SUBMIT_REVERSE_SEARCH]: [{ key: 'return', ctrl: false }],
[Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]: [{ key: 'tab' }],
[Command.TOGGLE_SHELL_INPUT_FOCUS_IN]: [{ key: 'tab', shift: false }],
[Command.TOGGLE_SHELL_INPUT_FOCUS_OUT]: [
{ key: 'tab', shift: false },
{ key: 'tab', shift: true },
],
[Command.FOCUS_SHELL_INPUT]: [{ key: 'tab', shift: false }],
[Command.UNFOCUS_SHELL_INPUT]: [{ key: 'tab' }],
// Suggestion expansion
[Command.EXPAND_SUGGESTION]: [{ key: 'right' }],
[Command.COLLAPSE_SUGGESTION]: [{ key: 'left' }],
@@ -364,14 +361,14 @@ export const commandCategories: readonly CommandCategory[] = [
commands: [
Command.SHOW_ERROR_DETAILS,
Command.SHOW_FULL_TODOS,
Command.TOGGLE_IDE_CONTEXT_DETAIL,
Command.SHOW_IDE_CONTEXT_DETAIL,
Command.TOGGLE_MARKDOWN,
Command.TOGGLE_COPY_MODE,
Command.TOGGLE_YOLO,
Command.TOGGLE_AUTO_EDIT,
Command.SHOW_MORE_LINES,
Command.TOGGLE_SHELL_INPUT_FOCUS_IN,
Command.TOGGLE_SHELL_INPUT_FOCUS_OUT,
Command.FOCUS_SHELL_INPUT,
Command.UNFOCUS_SHELL_INPUT,
],
},
{
@@ -424,7 +421,7 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
[Command.PASTE_CLIPBOARD]: 'Paste from the clipboard.',
[Command.SHOW_ERROR_DETAILS]: 'Toggle detailed error information.',
[Command.SHOW_FULL_TODOS]: 'Toggle the full TODO list.',
[Command.TOGGLE_IDE_CONTEXT_DETAIL]: 'Toggle IDE context details.',
[Command.SHOW_IDE_CONTEXT_DETAIL]: 'Show IDE context details.',
[Command.TOGGLE_MARKDOWN]: 'Toggle Markdown rendering.',
[Command.TOGGLE_COPY_MODE]:
'Toggle copy mode when the terminal is using the alternate buffer.',
@@ -435,13 +432,11 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
[Command.SHOW_MORE_LINES]:
'Expand a height-constrained response to show additional lines.',
[Command.REVERSE_SEARCH]: 'Start reverse search through history.',
[Command.SUBMIT_REVERSE_SEARCH]: 'Insert the selected reverse-search match.',
[Command.SUBMIT_REVERSE_SEARCH]: 'Submit the selected reverse-search match.',
[Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]:
'Accept a suggestion while reverse searching.',
[Command.TOGGLE_SHELL_INPUT_FOCUS_IN]:
'Toggle focus between the shell and Gemini input.',
[Command.TOGGLE_SHELL_INPUT_FOCUS_OUT]:
'Toggle focus out of the interactive shell and into Gemini input.',
[Command.FOCUS_SHELL_INPUT]: 'Focus the shell input from the gemini input.',
[Command.UNFOCUS_SHELL_INPUT]: 'Focus the Gemini input from the shell input.',
[Command.EXPAND_SUGGESTION]: 'Expand an inline suggestion.',
[Command.COLLAPSE_SUGGESTION]: 'Collapse an inline suggestion.',
};

View File

@@ -1277,7 +1277,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
return newValue;
});
} else if (
keyMatchers[Command.TOGGLE_IDE_CONTEXT_DETAIL](key) &&
keyMatchers[Command.SHOW_IDE_CONTEXT_DETAIL](key) &&
config.getIdeMode() &&
ideContextState
) {
@@ -1289,7 +1289,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
) {
setConstrainHeight(false);
} else if (
keyMatchers[Command.TOGGLE_SHELL_INPUT_FOCUS_OUT](key) &&
keyMatchers[Command.UNFOCUS_SHELL_INPUT](key) &&
activePtyId &&
embeddedShellFocused
) {

View File

@@ -829,7 +829,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
return;
}
if (keyMatchers[Command.TOGGLE_SHELL_INPUT_FOCUS_IN](key)) {
if (keyMatchers[Command.FOCUS_SHELL_INPUT](key)) {
// If we got here, Autocomplete didn't handle the key (e.g. no suggestions).
if (activePtyId) {
setEmbeddedShellFocused(true);

View File

@@ -289,7 +289,7 @@ describe('keyMatchers', () => {
negative: [createKey('t'), createKey('e', { ctrl: true })],
},
{
command: Command.TOGGLE_IDE_CONTEXT_DETAIL,
command: Command.SHOW_IDE_CONTEXT_DETAIL,
positive: [createKey('g', { ctrl: true })],
negative: [createKey('g'), createKey('t', { ctrl: true })],
},
@@ -336,7 +336,7 @@ describe('keyMatchers', () => {
negative: [createKey('return'), createKey('space')],
},
{
command: Command.TOGGLE_SHELL_INPUT_FOCUS_IN,
command: Command.FOCUS_SHELL_INPUT,
positive: [createKey('tab')],
negative: [createKey('f', { ctrl: true }), createKey('f')],
},