mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
cleanup: Organize key bindings (#16798)
This commit is contained in:
committed by
GitHub
parent
cfdc4cfca8
commit
ce35d84113
@@ -8,10 +8,12 @@ available combinations.
|
|||||||
|
|
||||||
#### Basic Controls
|
#### Basic Controls
|
||||||
|
|
||||||
| Action | Keys |
|
| Action | Keys |
|
||||||
| -------------------------------------------- | ------- |
|
| --------------------------------------------------------------- | ---------- |
|
||||||
| Confirm the current selection or choice. | `Enter` |
|
| Confirm the current selection or choice. | `Enter` |
|
||||||
| Dismiss dialogs or cancel the current focus. | `Esc` |
|
| Dismiss dialogs or cancel the current focus. | `Esc` |
|
||||||
|
| Cancel the current request or quit the CLI when input is empty. | `Ctrl + C` |
|
||||||
|
| Exit the CLI when the input buffer is empty. | `Ctrl + D` |
|
||||||
|
|
||||||
#### Cursor Movement
|
#### Cursor Movement
|
||||||
|
|
||||||
@@ -40,12 +42,6 @@ available combinations.
|
|||||||
| Undo the most recent text edit. | `Ctrl + Z (no Shift)` |
|
| Undo the most recent text edit. | `Ctrl + Z (no Shift)` |
|
||||||
| Redo the most recent undone text edit. | `Ctrl + Shift + Z` |
|
| Redo the most recent undone text edit. | `Ctrl + Shift + Z` |
|
||||||
|
|
||||||
#### Screen Control
|
|
||||||
|
|
||||||
| Action | Keys |
|
|
||||||
| -------------------------------------------- | ---------- |
|
|
||||||
| Clear the terminal screen and redraw the UI. | `Ctrl + L` |
|
|
||||||
|
|
||||||
#### Scrolling
|
#### Scrolling
|
||||||
|
|
||||||
| Action | Keys |
|
| Action | Keys |
|
||||||
@@ -88,39 +84,28 @@ available combinations.
|
|||||||
|
|
||||||
#### Text Input
|
#### Text Input
|
||||||
|
|
||||||
| Action | Keys |
|
| Action | Keys |
|
||||||
| ------------------------------------ | ---------------------------------------------------------------------- |
|
| ---------------------------------------------- | ---------------------------------------------------------------------- |
|
||||||
| Submit the current prompt. | `Enter (no Ctrl, no Shift, no Cmd)` |
|
| Submit the current prompt. | `Enter (no Ctrl, no Shift, no Cmd)` |
|
||||||
| Insert a newline without submitting. | `Ctrl + Enter`<br />`Cmd + Enter`<br />`Shift + Enter`<br />`Ctrl + J` |
|
| Insert a newline without submitting. | `Ctrl + Enter`<br />`Cmd + Enter`<br />`Shift + Enter`<br />`Ctrl + J` |
|
||||||
|
| Open the current prompt in an external editor. | `Ctrl + X` |
|
||||||
#### External Tools
|
| Paste from the clipboard. | `Ctrl + V`<br />`Cmd + V` |
|
||||||
|
|
||||||
| Action | Keys |
|
|
||||||
| ---------------------------------------------- | ------------------------- |
|
|
||||||
| Open the current prompt in an external editor. | `Ctrl + X` |
|
|
||||||
| Paste from the clipboard. | `Ctrl + V`<br />`Cmd + V` |
|
|
||||||
|
|
||||||
#### App Controls
|
#### App Controls
|
||||||
|
|
||||||
| Action | Keys |
|
| Action | Keys |
|
||||||
| ----------------------------------------------------------------- | ---------------- |
|
| ------------------------------------------------------------------------------------------------ | ---------------- |
|
||||||
| Toggle detailed error information. | `F12` |
|
| Toggle detailed error information. | `F12` |
|
||||||
| Toggle the full TODO list. | `Ctrl + T` |
|
| Toggle the full TODO list. | `Ctrl + T` |
|
||||||
| Show IDE context details. | `Ctrl + G` |
|
| Show IDE context details. | `Ctrl + G` |
|
||||||
| Toggle Markdown rendering. | `Cmd + M` |
|
| Toggle Markdown rendering. | `Cmd + M` |
|
||||||
| Toggle copy mode when the terminal is using the alternate buffer. | `Ctrl + S` |
|
| Toggle copy mode when in alternate buffer mode. | `Ctrl + S` |
|
||||||
| Toggle YOLO (auto-approval) mode for tool calls. | `Ctrl + Y` |
|
| Toggle YOLO (auto-approval) mode for tool calls. | `Ctrl + Y` |
|
||||||
| Toggle Auto Edit (auto-accept edits) mode. | `Shift + Tab` |
|
| Toggle Auto Edit (auto-accept edits) mode. | `Shift + Tab` |
|
||||||
| Expand a height-constrained response to show additional lines. | `Ctrl + S` |
|
| Expand a height-constrained response to show additional lines when not in alternate buffer mode. | `Ctrl + S` |
|
||||||
| Focus the shell input from the gemini input. | `Tab (no Shift)` |
|
| Focus the shell input from the gemini input. | `Tab (no Shift)` |
|
||||||
| Focus the Gemini input from the shell input. | `Tab` |
|
| Focus the Gemini input from the shell input. | `Tab` |
|
||||||
|
| Clear the terminal screen and redraw the UI. | `Ctrl + L` |
|
||||||
#### Session Control
|
|
||||||
|
|
||||||
| Action | Keys |
|
|
||||||
| -------------------------------------------- | ---------- |
|
|
||||||
| Cancel the current request or quit the CLI. | `Ctrl + C` |
|
|
||||||
| Exit the CLI when the input buffer is empty. | `Ctrl + D` |
|
|
||||||
|
|
||||||
<!-- KEYBINDINGS-AUTOGEN:END -->
|
<!-- KEYBINDINGS-AUTOGEN:END -->
|
||||||
|
|
||||||
|
|||||||
@@ -8,87 +8,79 @@
|
|||||||
* Command enum for all available keyboard shortcuts
|
* Command enum for all available keyboard shortcuts
|
||||||
*/
|
*/
|
||||||
export enum Command {
|
export enum Command {
|
||||||
// Basic bindings
|
// Basic Controls
|
||||||
RETURN = 'return',
|
RETURN = 'basic.confirm',
|
||||||
ESCAPE = 'escape',
|
ESCAPE = 'basic.cancel',
|
||||||
|
QUIT = 'basic.quit',
|
||||||
|
EXIT = 'basic.exit',
|
||||||
|
|
||||||
// Cursor movement
|
// Cursor Movement
|
||||||
HOME = 'home',
|
HOME = 'cursor.home',
|
||||||
END = 'end',
|
END = 'cursor.end',
|
||||||
|
MOVE_UP = 'cursor.up',
|
||||||
|
MOVE_DOWN = 'cursor.down',
|
||||||
|
MOVE_LEFT = 'cursor.left',
|
||||||
|
MOVE_RIGHT = 'cursor.right',
|
||||||
|
MOVE_WORD_LEFT = 'cursor.wordLeft',
|
||||||
|
MOVE_WORD_RIGHT = 'cursor.wordRight',
|
||||||
|
|
||||||
// Text deletion
|
// Editing
|
||||||
KILL_LINE_RIGHT = 'killLineRight',
|
KILL_LINE_RIGHT = 'edit.deleteRightAll',
|
||||||
KILL_LINE_LEFT = 'killLineLeft',
|
KILL_LINE_LEFT = 'edit.deleteLeftAll',
|
||||||
CLEAR_INPUT = 'clearInput',
|
CLEAR_INPUT = 'edit.clear',
|
||||||
DELETE_WORD_BACKWARD = 'deleteWordBackward',
|
DELETE_WORD_BACKWARD = 'edit.deleteWordLeft',
|
||||||
|
DELETE_WORD_FORWARD = 'edit.deleteWordRight',
|
||||||
// Screen control
|
DELETE_CHAR_LEFT = 'edit.deleteLeft',
|
||||||
CLEAR_SCREEN = 'clearScreen',
|
DELETE_CHAR_RIGHT = 'edit.deleteRight',
|
||||||
|
UNDO = 'edit.undo',
|
||||||
|
REDO = 'edit.redo',
|
||||||
|
|
||||||
// Scrolling
|
// Scrolling
|
||||||
SCROLL_UP = 'scrollUp',
|
SCROLL_UP = 'scroll.up',
|
||||||
SCROLL_DOWN = 'scrollDown',
|
SCROLL_DOWN = 'scroll.down',
|
||||||
SCROLL_HOME = 'scrollHome',
|
SCROLL_HOME = 'scroll.home',
|
||||||
SCROLL_END = 'scrollEnd',
|
SCROLL_END = 'scroll.end',
|
||||||
PAGE_UP = 'pageUp',
|
PAGE_UP = 'scroll.pageUp',
|
||||||
PAGE_DOWN = 'pageDown',
|
PAGE_DOWN = 'scroll.pageDown',
|
||||||
|
|
||||||
// History navigation
|
// History & Search
|
||||||
HISTORY_UP = 'historyUp',
|
HISTORY_UP = 'history.previous',
|
||||||
HISTORY_DOWN = 'historyDown',
|
HISTORY_DOWN = 'history.next',
|
||||||
NAVIGATION_UP = 'navigationUp',
|
REVERSE_SEARCH = 'history.search.start',
|
||||||
NAVIGATION_DOWN = 'navigationDown',
|
SUBMIT_REVERSE_SEARCH = 'history.search.submit',
|
||||||
|
ACCEPT_SUGGESTION_REVERSE_SEARCH = 'history.search.accept',
|
||||||
|
|
||||||
// Dialog navigation
|
// Navigation
|
||||||
DIALOG_NAVIGATION_UP = 'dialogNavigationUp',
|
NAVIGATION_UP = 'nav.up',
|
||||||
DIALOG_NAVIGATION_DOWN = 'dialogNavigationDown',
|
NAVIGATION_DOWN = 'nav.down',
|
||||||
|
DIALOG_NAVIGATION_UP = 'nav.dialog.up',
|
||||||
|
DIALOG_NAVIGATION_DOWN = 'nav.dialog.down',
|
||||||
|
|
||||||
// Auto-completion
|
// Suggestions & Completions
|
||||||
ACCEPT_SUGGESTION = 'acceptSuggestion',
|
ACCEPT_SUGGESTION = 'suggest.accept',
|
||||||
COMPLETION_UP = 'completionUp',
|
COMPLETION_UP = 'suggest.focusPrevious',
|
||||||
COMPLETION_DOWN = 'completionDown',
|
COMPLETION_DOWN = 'suggest.focusNext',
|
||||||
|
EXPAND_SUGGESTION = 'suggest.expand',
|
||||||
|
COLLAPSE_SUGGESTION = 'suggest.collapse',
|
||||||
|
|
||||||
// Text input
|
// Text Input
|
||||||
SUBMIT = 'submit',
|
SUBMIT = 'input.submit',
|
||||||
NEWLINE = 'newline',
|
NEWLINE = 'input.newline',
|
||||||
|
OPEN_EXTERNAL_EDITOR = 'input.openExternalEditor',
|
||||||
|
PASTE_CLIPBOARD = 'input.paste',
|
||||||
|
|
||||||
// External tools
|
// App Controls
|
||||||
OPEN_EXTERNAL_EDITOR = 'openExternalEditor',
|
SHOW_ERROR_DETAILS = 'app.showErrorDetails',
|
||||||
PASTE_CLIPBOARD = 'pasteClipboard',
|
SHOW_FULL_TODOS = 'app.showFullTodos',
|
||||||
|
SHOW_IDE_CONTEXT_DETAIL = 'app.showIdeContextDetail',
|
||||||
// App level bindings
|
TOGGLE_MARKDOWN = 'app.toggleMarkdown',
|
||||||
SHOW_ERROR_DETAILS = 'showErrorDetails',
|
TOGGLE_COPY_MODE = 'app.toggleCopyMode',
|
||||||
SHOW_FULL_TODOS = 'showFullTodos',
|
TOGGLE_YOLO = 'app.toggleYolo',
|
||||||
SHOW_IDE_CONTEXT_DETAIL = 'showIDEContextDetail',
|
TOGGLE_AUTO_EDIT = 'app.toggleAutoEdit',
|
||||||
TOGGLE_MARKDOWN = 'toggleMarkdown',
|
SHOW_MORE_LINES = 'app.showMoreLines',
|
||||||
TOGGLE_COPY_MODE = 'toggleCopyMode',
|
FOCUS_SHELL_INPUT = 'app.focusShellInput',
|
||||||
TOGGLE_YOLO = 'toggleYolo',
|
UNFOCUS_SHELL_INPUT = 'app.unfocusShellInput',
|
||||||
TOGGLE_AUTO_EDIT = 'toggleAutoEdit',
|
CLEAR_SCREEN = 'app.clearScreen',
|
||||||
UNDO = 'undo',
|
|
||||||
REDO = 'redo',
|
|
||||||
MOVE_UP = 'moveUp',
|
|
||||||
MOVE_DOWN = 'moveDown',
|
|
||||||
MOVE_LEFT = 'moveLeft',
|
|
||||||
MOVE_RIGHT = 'moveRight',
|
|
||||||
MOVE_WORD_LEFT = 'moveWordLeft',
|
|
||||||
MOVE_WORD_RIGHT = 'moveWordRight',
|
|
||||||
DELETE_CHAR_LEFT = 'deleteCharLeft',
|
|
||||||
DELETE_CHAR_RIGHT = 'deleteCharRight',
|
|
||||||
DELETE_WORD_FORWARD = 'deleteWordForward',
|
|
||||||
QUIT = 'quit',
|
|
||||||
EXIT = 'exit',
|
|
||||||
SHOW_MORE_LINES = 'showMoreLines',
|
|
||||||
|
|
||||||
// Shell commands
|
|
||||||
REVERSE_SEARCH = 'reverseSearch',
|
|
||||||
SUBMIT_REVERSE_SEARCH = 'submitReverseSearch',
|
|
||||||
ACCEPT_SUGGESTION_REVERSE_SEARCH = 'acceptSuggestionReverseSearch',
|
|
||||||
FOCUS_SHELL_INPUT = 'focusShellInput',
|
|
||||||
UNFOCUS_SHELL_INPUT = 'unfocusShellInput',
|
|
||||||
|
|
||||||
// Suggestion expansion
|
|
||||||
EXPAND_SUGGESTION = 'expandSuggestion',
|
|
||||||
COLLAPSE_SUGGESTION = 'collapseSuggestion',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,24 +109,17 @@ export type KeyBindingConfig = {
|
|||||||
* Matches the original hard-coded logic exactly
|
* Matches the original hard-coded logic exactly
|
||||||
*/
|
*/
|
||||||
export const defaultKeyBindings: KeyBindingConfig = {
|
export const defaultKeyBindings: KeyBindingConfig = {
|
||||||
// Basic bindings
|
// Basic Controls
|
||||||
[Command.RETURN]: [{ key: 'return' }],
|
[Command.RETURN]: [{ key: 'return' }],
|
||||||
[Command.ESCAPE]: [{ key: 'escape' }],
|
[Command.ESCAPE]: [{ key: 'escape' }],
|
||||||
|
[Command.QUIT]: [{ key: 'c', ctrl: true }],
|
||||||
|
[Command.EXIT]: [{ key: 'd', ctrl: true }],
|
||||||
|
|
||||||
// Cursor movement
|
// Cursor Movement
|
||||||
[Command.HOME]: [{ key: 'a', ctrl: true }, { key: 'home' }],
|
[Command.HOME]: [{ key: 'a', ctrl: true }, { key: 'home' }],
|
||||||
[Command.END]: [{ key: 'e', ctrl: true }, { key: 'end' }],
|
[Command.END]: [{ key: 'e', ctrl: true }, { key: 'end' }],
|
||||||
|
[Command.MOVE_UP]: [{ key: 'up', ctrl: false, command: false }],
|
||||||
// Text deletion
|
[Command.MOVE_DOWN]: [{ key: 'down', ctrl: false, command: false }],
|
||||||
[Command.KILL_LINE_RIGHT]: [{ key: 'k', ctrl: true }],
|
|
||||||
[Command.KILL_LINE_LEFT]: [{ key: 'u', ctrl: true }],
|
|
||||||
[Command.CLEAR_INPUT]: [{ key: 'c', ctrl: true }],
|
|
||||||
// Added command (meta/alt/option) for mac compatibility
|
|
||||||
[Command.DELETE_WORD_BACKWARD]: [
|
|
||||||
{ key: 'backspace', ctrl: true },
|
|
||||||
{ key: 'backspace', command: true },
|
|
||||||
{ key: 'w', ctrl: true },
|
|
||||||
],
|
|
||||||
[Command.MOVE_LEFT]: [
|
[Command.MOVE_LEFT]: [
|
||||||
{ key: 'left', ctrl: false, command: false },
|
{ key: 'left', ctrl: false, command: false },
|
||||||
{ key: 'b', ctrl: true },
|
{ key: 'b', ctrl: true },
|
||||||
@@ -143,8 +128,6 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
{ key: 'right', ctrl: false, command: false },
|
{ key: 'right', ctrl: false, command: false },
|
||||||
{ key: 'f', ctrl: true },
|
{ key: 'f', ctrl: true },
|
||||||
],
|
],
|
||||||
[Command.MOVE_UP]: [{ key: 'up', ctrl: false, command: false }],
|
|
||||||
[Command.MOVE_DOWN]: [{ key: 'down', ctrl: false, command: false }],
|
|
||||||
[Command.MOVE_WORD_LEFT]: [
|
[Command.MOVE_WORD_LEFT]: [
|
||||||
{ key: 'left', ctrl: true },
|
{ key: 'left', ctrl: true },
|
||||||
{ key: 'left', command: true },
|
{ key: 'left', command: true },
|
||||||
@@ -155,15 +138,25 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
{ key: 'right', command: true },
|
{ key: 'right', command: true },
|
||||||
{ key: 'f', command: true },
|
{ key: 'f', command: true },
|
||||||
],
|
],
|
||||||
[Command.DELETE_CHAR_LEFT]: [{ key: 'backspace' }, { key: 'h', ctrl: true }],
|
|
||||||
[Command.DELETE_CHAR_RIGHT]: [{ key: 'delete' }, { key: 'd', ctrl: true }],
|
// Editing
|
||||||
|
[Command.KILL_LINE_RIGHT]: [{ key: 'k', ctrl: true }],
|
||||||
|
[Command.KILL_LINE_LEFT]: [{ key: 'u', ctrl: true }],
|
||||||
|
[Command.CLEAR_INPUT]: [{ key: 'c', ctrl: true }],
|
||||||
|
// Added command (meta/alt/option) for mac compatibility
|
||||||
|
[Command.DELETE_WORD_BACKWARD]: [
|
||||||
|
{ key: 'backspace', ctrl: true },
|
||||||
|
{ key: 'backspace', command: true },
|
||||||
|
{ key: 'w', ctrl: true },
|
||||||
|
],
|
||||||
[Command.DELETE_WORD_FORWARD]: [
|
[Command.DELETE_WORD_FORWARD]: [
|
||||||
{ key: 'delete', ctrl: true },
|
{ key: 'delete', ctrl: true },
|
||||||
{ key: 'delete', command: true },
|
{ key: 'delete', command: true },
|
||||||
],
|
],
|
||||||
|
[Command.DELETE_CHAR_LEFT]: [{ key: 'backspace' }, { key: 'h', ctrl: true }],
|
||||||
// Screen control
|
[Command.DELETE_CHAR_RIGHT]: [{ key: 'delete' }, { key: 'd', ctrl: true }],
|
||||||
[Command.CLEAR_SCREEN]: [{ key: 'l', ctrl: true }],
|
[Command.UNDO]: [{ key: 'z', ctrl: true, shift: false }],
|
||||||
|
[Command.REDO]: [{ key: 'z', ctrl: true, shift: true }],
|
||||||
|
|
||||||
// Scrolling
|
// Scrolling
|
||||||
[Command.SCROLL_UP]: [{ key: 'up', shift: true }],
|
[Command.SCROLL_UP]: [{ key: 'up', shift: true }],
|
||||||
@@ -173,13 +166,17 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
[Command.PAGE_UP]: [{ key: 'pageup' }],
|
[Command.PAGE_UP]: [{ key: 'pageup' }],
|
||||||
[Command.PAGE_DOWN]: [{ key: 'pagedown' }],
|
[Command.PAGE_DOWN]: [{ key: 'pagedown' }],
|
||||||
|
|
||||||
// History navigation
|
// History & Search
|
||||||
[Command.HISTORY_UP]: [{ key: 'p', ctrl: true, shift: false }],
|
[Command.HISTORY_UP]: [{ key: 'p', ctrl: true, shift: false }],
|
||||||
[Command.HISTORY_DOWN]: [{ key: 'n', ctrl: true, shift: false }],
|
[Command.HISTORY_DOWN]: [{ key: 'n', ctrl: true, shift: false }],
|
||||||
|
[Command.REVERSE_SEARCH]: [{ key: 'r', ctrl: true }],
|
||||||
|
// 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' }],
|
||||||
|
|
||||||
|
// Navigation
|
||||||
[Command.NAVIGATION_UP]: [{ key: 'up', shift: false }],
|
[Command.NAVIGATION_UP]: [{ key: 'up', shift: false }],
|
||||||
[Command.NAVIGATION_DOWN]: [{ key: 'down', shift: false }],
|
[Command.NAVIGATION_DOWN]: [{ key: 'down', shift: false }],
|
||||||
|
|
||||||
// Dialog navigation
|
|
||||||
// Navigation shortcuts appropriate for dialogs where we do not need to accept
|
// Navigation shortcuts appropriate for dialogs where we do not need to accept
|
||||||
// text input.
|
// text input.
|
||||||
[Command.DIALOG_NAVIGATION_UP]: [
|
[Command.DIALOG_NAVIGATION_UP]: [
|
||||||
@@ -191,7 +188,7 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
{ key: 'j', shift: false },
|
{ key: 'j', shift: false },
|
||||||
],
|
],
|
||||||
|
|
||||||
// Auto-completion
|
// Suggestions & Completions
|
||||||
[Command.ACCEPT_SUGGESTION]: [{ key: 'tab' }, { key: 'return', ctrl: false }],
|
[Command.ACCEPT_SUGGESTION]: [{ key: 'tab' }, { key: 'return', ctrl: false }],
|
||||||
// Completion navigation (arrow or Ctrl+P/N)
|
// Completion navigation (arrow or Ctrl+P/N)
|
||||||
[Command.COMPLETION_UP]: [
|
[Command.COMPLETION_UP]: [
|
||||||
@@ -202,8 +199,10 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
{ key: 'down', shift: false },
|
{ key: 'down', shift: false },
|
||||||
{ key: 'n', ctrl: true, shift: false },
|
{ key: 'n', ctrl: true, shift: false },
|
||||||
],
|
],
|
||||||
|
[Command.EXPAND_SUGGESTION]: [{ key: 'right' }],
|
||||||
|
[Command.COLLAPSE_SUGGESTION]: [{ key: 'left' }],
|
||||||
|
|
||||||
// Text input
|
// Text Input
|
||||||
// Must also exclude shift to allow shift+enter for newline
|
// Must also exclude shift to allow shift+enter for newline
|
||||||
[Command.SUBMIT]: [
|
[Command.SUBMIT]: [
|
||||||
{
|
{
|
||||||
@@ -221,15 +220,13 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
{ key: 'return', shift: true },
|
{ key: 'return', shift: true },
|
||||||
{ key: 'j', ctrl: true },
|
{ key: 'j', ctrl: true },
|
||||||
],
|
],
|
||||||
|
|
||||||
// External tools
|
|
||||||
[Command.OPEN_EXTERNAL_EDITOR]: [{ key: 'x', ctrl: true }],
|
[Command.OPEN_EXTERNAL_EDITOR]: [{ key: 'x', ctrl: true }],
|
||||||
[Command.PASTE_CLIPBOARD]: [
|
[Command.PASTE_CLIPBOARD]: [
|
||||||
{ key: 'v', ctrl: true },
|
{ key: 'v', ctrl: true },
|
||||||
{ key: 'v', command: true },
|
{ key: 'v', command: true },
|
||||||
],
|
],
|
||||||
|
|
||||||
// App level bindings
|
// App Controls
|
||||||
[Command.SHOW_ERROR_DETAILS]: [{ key: 'f12' }],
|
[Command.SHOW_ERROR_DETAILS]: [{ key: 'f12' }],
|
||||||
[Command.SHOW_FULL_TODOS]: [{ key: 't', ctrl: true }],
|
[Command.SHOW_FULL_TODOS]: [{ key: 't', ctrl: true }],
|
||||||
[Command.SHOW_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }],
|
[Command.SHOW_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }],
|
||||||
@@ -237,22 +234,10 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
|||||||
[Command.TOGGLE_COPY_MODE]: [{ key: 's', ctrl: true }],
|
[Command.TOGGLE_COPY_MODE]: [{ key: 's', ctrl: true }],
|
||||||
[Command.TOGGLE_YOLO]: [{ key: 'y', ctrl: true }],
|
[Command.TOGGLE_YOLO]: [{ key: 'y', ctrl: true }],
|
||||||
[Command.TOGGLE_AUTO_EDIT]: [{ key: 'tab', shift: true }],
|
[Command.TOGGLE_AUTO_EDIT]: [{ key: 'tab', shift: true }],
|
||||||
[Command.UNDO]: [{ key: 'z', ctrl: true, shift: false }],
|
|
||||||
[Command.REDO]: [{ key: 'z', ctrl: true, shift: true }],
|
|
||||||
[Command.QUIT]: [{ key: 'c', ctrl: true }],
|
|
||||||
[Command.EXIT]: [{ key: 'd', ctrl: true }],
|
|
||||||
[Command.SHOW_MORE_LINES]: [{ key: 's', ctrl: true }],
|
[Command.SHOW_MORE_LINES]: [{ key: 's', ctrl: true }],
|
||||||
|
|
||||||
// Shell commands
|
|
||||||
[Command.REVERSE_SEARCH]: [{ key: 'r', ctrl: true }],
|
|
||||||
// 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.FOCUS_SHELL_INPUT]: [{ key: 'tab', shift: false }],
|
[Command.FOCUS_SHELL_INPUT]: [{ key: 'tab', shift: false }],
|
||||||
[Command.UNFOCUS_SHELL_INPUT]: [{ key: 'tab' }],
|
[Command.UNFOCUS_SHELL_INPUT]: [{ key: 'tab' }],
|
||||||
// Suggestion expansion
|
[Command.CLEAR_SCREEN]: [{ key: 'l', ctrl: true }],
|
||||||
[Command.EXPAND_SUGGESTION]: [{ key: 'right' }],
|
|
||||||
[Command.COLLAPSE_SUGGESTION]: [{ key: 'left' }],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface CommandCategory {
|
interface CommandCategory {
|
||||||
@@ -266,7 +251,7 @@ interface CommandCategory {
|
|||||||
export const commandCategories: readonly CommandCategory[] = [
|
export const commandCategories: readonly CommandCategory[] = [
|
||||||
{
|
{
|
||||||
title: 'Basic Controls',
|
title: 'Basic Controls',
|
||||||
commands: [Command.RETURN, Command.ESCAPE],
|
commands: [Command.RETURN, Command.ESCAPE, Command.QUIT, Command.EXIT],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Cursor Movement',
|
title: 'Cursor Movement',
|
||||||
@@ -295,10 +280,6 @@ export const commandCategories: readonly CommandCategory[] = [
|
|||||||
Command.REDO,
|
Command.REDO,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Screen Control',
|
|
||||||
commands: [Command.CLEAR_SCREEN],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Scrolling',
|
title: 'Scrolling',
|
||||||
commands: [
|
commands: [
|
||||||
@@ -341,11 +322,12 @@ export const commandCategories: readonly CommandCategory[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Text Input',
|
title: 'Text Input',
|
||||||
commands: [Command.SUBMIT, Command.NEWLINE],
|
commands: [
|
||||||
},
|
Command.SUBMIT,
|
||||||
{
|
Command.NEWLINE,
|
||||||
title: 'External Tools',
|
Command.OPEN_EXTERNAL_EDITOR,
|
||||||
commands: [Command.OPEN_EXTERNAL_EDITOR, Command.PASTE_CLIPBOARD],
|
Command.PASTE_CLIPBOARD,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'App Controls',
|
title: 'App Controls',
|
||||||
@@ -360,28 +342,33 @@ export const commandCategories: readonly CommandCategory[] = [
|
|||||||
Command.SHOW_MORE_LINES,
|
Command.SHOW_MORE_LINES,
|
||||||
Command.FOCUS_SHELL_INPUT,
|
Command.FOCUS_SHELL_INPUT,
|
||||||
Command.UNFOCUS_SHELL_INPUT,
|
Command.UNFOCUS_SHELL_INPUT,
|
||||||
|
Command.CLEAR_SCREEN,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Session Control',
|
|
||||||
commands: [Command.QUIT, Command.EXIT],
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Human-readable descriptions for each command, used in docs/tooling.
|
* Human-readable descriptions for each command, used in docs/tooling.
|
||||||
*/
|
*/
|
||||||
export const commandDescriptions: Readonly<Record<Command, string>> = {
|
export const commandDescriptions: Readonly<Record<Command, string>> = {
|
||||||
|
// Basic Controls
|
||||||
[Command.RETURN]: 'Confirm the current selection or choice.',
|
[Command.RETURN]: 'Confirm the current selection or choice.',
|
||||||
[Command.ESCAPE]: 'Dismiss dialogs or cancel the current focus.',
|
[Command.ESCAPE]: 'Dismiss dialogs or cancel the current focus.',
|
||||||
|
[Command.QUIT]:
|
||||||
|
'Cancel the current request or quit the CLI when input is empty.',
|
||||||
|
[Command.EXIT]: 'Exit the CLI when the input buffer is empty.',
|
||||||
|
|
||||||
|
// Cursor Movement
|
||||||
[Command.HOME]: 'Move the cursor to the start of the line.',
|
[Command.HOME]: 'Move the cursor to the start of the line.',
|
||||||
[Command.END]: 'Move the cursor to the end of the line.',
|
[Command.END]: 'Move the cursor to the end of the line.',
|
||||||
[Command.MOVE_LEFT]: 'Move the cursor one character to the left.',
|
|
||||||
[Command.MOVE_RIGHT]: 'Move the cursor one character to the right.',
|
|
||||||
[Command.MOVE_UP]: 'Move the cursor up one line.',
|
[Command.MOVE_UP]: 'Move the cursor up one line.',
|
||||||
[Command.MOVE_DOWN]: 'Move the cursor down one line.',
|
[Command.MOVE_DOWN]: 'Move the cursor down one line.',
|
||||||
|
[Command.MOVE_LEFT]: 'Move the cursor one character to the left.',
|
||||||
|
[Command.MOVE_RIGHT]: 'Move the cursor one character to the right.',
|
||||||
[Command.MOVE_WORD_LEFT]: 'Move the cursor one word to the left.',
|
[Command.MOVE_WORD_LEFT]: 'Move the cursor one word to the left.',
|
||||||
[Command.MOVE_WORD_RIGHT]: 'Move the cursor one word to the right.',
|
[Command.MOVE_WORD_RIGHT]: 'Move the cursor one word to the right.',
|
||||||
|
|
||||||
|
// Editing
|
||||||
[Command.KILL_LINE_RIGHT]: 'Delete from the cursor to the end of the line.',
|
[Command.KILL_LINE_RIGHT]: 'Delete from the cursor to the end of the line.',
|
||||||
[Command.KILL_LINE_LEFT]: 'Delete from the cursor to the start of the line.',
|
[Command.KILL_LINE_LEFT]: 'Delete from the cursor to the start of the line.',
|
||||||
[Command.CLEAR_INPUT]: 'Clear all text in the input field.',
|
[Command.CLEAR_INPUT]: 'Clear all text in the input field.',
|
||||||
@@ -391,45 +378,54 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
|
|||||||
[Command.DELETE_CHAR_RIGHT]: 'Delete the character to the right.',
|
[Command.DELETE_CHAR_RIGHT]: 'Delete the character to the right.',
|
||||||
[Command.UNDO]: 'Undo the most recent text edit.',
|
[Command.UNDO]: 'Undo the most recent text edit.',
|
||||||
[Command.REDO]: 'Redo the most recent undone text edit.',
|
[Command.REDO]: 'Redo the most recent undone text edit.',
|
||||||
[Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.',
|
|
||||||
|
// Scrolling
|
||||||
[Command.SCROLL_UP]: 'Scroll content up.',
|
[Command.SCROLL_UP]: 'Scroll content up.',
|
||||||
[Command.SCROLL_DOWN]: 'Scroll content down.',
|
[Command.SCROLL_DOWN]: 'Scroll content down.',
|
||||||
[Command.SCROLL_HOME]: 'Scroll to the top.',
|
[Command.SCROLL_HOME]: 'Scroll to the top.',
|
||||||
[Command.SCROLL_END]: 'Scroll to the bottom.',
|
[Command.SCROLL_END]: 'Scroll to the bottom.',
|
||||||
[Command.PAGE_UP]: 'Scroll up by one page.',
|
[Command.PAGE_UP]: 'Scroll up by one page.',
|
||||||
[Command.PAGE_DOWN]: 'Scroll down by one page.',
|
[Command.PAGE_DOWN]: 'Scroll down by one page.',
|
||||||
|
|
||||||
|
// History & Search
|
||||||
[Command.HISTORY_UP]: 'Show the previous entry in history.',
|
[Command.HISTORY_UP]: 'Show the previous entry in history.',
|
||||||
[Command.HISTORY_DOWN]: 'Show the next entry in history.',
|
[Command.HISTORY_DOWN]: 'Show the next entry in history.',
|
||||||
|
[Command.REVERSE_SEARCH]: 'Start reverse search through history.',
|
||||||
|
[Command.SUBMIT_REVERSE_SEARCH]: 'Submit the selected reverse-search match.',
|
||||||
|
[Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]:
|
||||||
|
'Accept a suggestion while reverse searching.',
|
||||||
|
|
||||||
|
// Navigation
|
||||||
[Command.NAVIGATION_UP]: 'Move selection up in lists.',
|
[Command.NAVIGATION_UP]: 'Move selection up in lists.',
|
||||||
[Command.NAVIGATION_DOWN]: 'Move selection down in lists.',
|
[Command.NAVIGATION_DOWN]: 'Move selection down in lists.',
|
||||||
[Command.DIALOG_NAVIGATION_UP]: 'Move up within dialog options.',
|
[Command.DIALOG_NAVIGATION_UP]: 'Move up within dialog options.',
|
||||||
[Command.DIALOG_NAVIGATION_DOWN]: 'Move down within dialog options.',
|
[Command.DIALOG_NAVIGATION_DOWN]: 'Move down within dialog options.',
|
||||||
|
|
||||||
|
// Suggestions & Completions
|
||||||
[Command.ACCEPT_SUGGESTION]: 'Accept the inline suggestion.',
|
[Command.ACCEPT_SUGGESTION]: 'Accept the inline suggestion.',
|
||||||
[Command.COMPLETION_UP]: 'Move to the previous completion option.',
|
[Command.COMPLETION_UP]: 'Move to the previous completion option.',
|
||||||
[Command.COMPLETION_DOWN]: 'Move to the next completion option.',
|
[Command.COMPLETION_DOWN]: 'Move to the next completion option.',
|
||||||
|
[Command.EXPAND_SUGGESTION]: 'Expand an inline suggestion.',
|
||||||
|
[Command.COLLAPSE_SUGGESTION]: 'Collapse an inline suggestion.',
|
||||||
|
|
||||||
|
// Text Input
|
||||||
[Command.SUBMIT]: 'Submit the current prompt.',
|
[Command.SUBMIT]: 'Submit the current prompt.',
|
||||||
[Command.NEWLINE]: 'Insert a newline without submitting.',
|
[Command.NEWLINE]: 'Insert a newline without submitting.',
|
||||||
[Command.OPEN_EXTERNAL_EDITOR]:
|
[Command.OPEN_EXTERNAL_EDITOR]:
|
||||||
'Open the current prompt in an external editor.',
|
'Open the current prompt in an external editor.',
|
||||||
[Command.PASTE_CLIPBOARD]: 'Paste from the clipboard.',
|
[Command.PASTE_CLIPBOARD]: 'Paste from the clipboard.',
|
||||||
|
|
||||||
|
// App Controls
|
||||||
[Command.SHOW_ERROR_DETAILS]: 'Toggle detailed error information.',
|
[Command.SHOW_ERROR_DETAILS]: 'Toggle detailed error information.',
|
||||||
[Command.SHOW_FULL_TODOS]: 'Toggle the full TODO list.',
|
[Command.SHOW_FULL_TODOS]: 'Toggle the full TODO list.',
|
||||||
[Command.SHOW_IDE_CONTEXT_DETAIL]: 'Show IDE context details.',
|
[Command.SHOW_IDE_CONTEXT_DETAIL]: 'Show IDE context details.',
|
||||||
[Command.TOGGLE_MARKDOWN]: 'Toggle Markdown rendering.',
|
[Command.TOGGLE_MARKDOWN]: 'Toggle Markdown rendering.',
|
||||||
[Command.TOGGLE_COPY_MODE]:
|
[Command.TOGGLE_COPY_MODE]: 'Toggle copy mode when in alternate buffer mode.',
|
||||||
'Toggle copy mode when the terminal is using the alternate buffer.',
|
|
||||||
[Command.TOGGLE_YOLO]: 'Toggle YOLO (auto-approval) mode for tool calls.',
|
[Command.TOGGLE_YOLO]: 'Toggle YOLO (auto-approval) mode for tool calls.',
|
||||||
[Command.TOGGLE_AUTO_EDIT]: 'Toggle Auto Edit (auto-accept edits) mode.',
|
[Command.TOGGLE_AUTO_EDIT]: 'Toggle Auto Edit (auto-accept edits) mode.',
|
||||||
[Command.QUIT]: 'Cancel the current request or quit the CLI.',
|
|
||||||
[Command.EXIT]: 'Exit the CLI when the input buffer is empty.',
|
|
||||||
[Command.SHOW_MORE_LINES]:
|
[Command.SHOW_MORE_LINES]:
|
||||||
'Expand a height-constrained response to show additional lines.',
|
'Expand a height-constrained response to show additional lines when not in alternate buffer mode.',
|
||||||
[Command.REVERSE_SEARCH]: 'Start reverse search through history.',
|
|
||||||
[Command.SUBMIT_REVERSE_SEARCH]: 'Submit the selected reverse-search match.',
|
|
||||||
[Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]:
|
|
||||||
'Accept a suggestion while reverse searching.',
|
|
||||||
[Command.FOCUS_SHELL_INPUT]: 'Focus the shell input from the 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.UNFOCUS_SHELL_INPUT]: 'Focus the Gemini input from the shell input.',
|
||||||
[Command.EXPAND_SUGGESTION]: 'Expand an inline suggestion.',
|
[Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.',
|
||||||
[Command.COLLAPSE_SUGGESTION]: 'Collapse an inline suggestion.',
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user