mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 02:00:40 -07:00
Migrate keybindings (#16460)
This commit is contained in:
committed by
GitHub
parent
548641c952
commit
8d3e93cdb0
@@ -64,6 +64,15 @@ export enum Command {
|
||||
TOGGLE_COPY_MODE = 'toggleCopyMode',
|
||||
TOGGLE_YOLO = 'toggleYolo',
|
||||
TOGGLE_AUTO_EDIT = 'toggleAutoEdit',
|
||||
UNDO = 'undo',
|
||||
REDO = 'redo',
|
||||
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',
|
||||
@@ -126,6 +135,37 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
||||
[Command.DELETE_WORD_BACKWARD]: [
|
||||
{ key: 'backspace', ctrl: true },
|
||||
{ key: 'backspace', command: true },
|
||||
{ sequence: '\x7f', ctrl: true },
|
||||
{ sequence: '\x7f', command: true },
|
||||
{ key: 'w', ctrl: true },
|
||||
],
|
||||
[Command.MOVE_LEFT]: [
|
||||
{ key: 'left', ctrl: false, command: false },
|
||||
{ key: 'b', ctrl: true },
|
||||
],
|
||||
[Command.MOVE_RIGHT]: [
|
||||
{ key: 'right', ctrl: false, command: false },
|
||||
{ key: 'f', ctrl: true },
|
||||
],
|
||||
[Command.MOVE_WORD_LEFT]: [
|
||||
{ key: 'left', ctrl: true },
|
||||
{ key: 'left', command: true },
|
||||
{ key: 'b', command: true },
|
||||
],
|
||||
[Command.MOVE_WORD_RIGHT]: [
|
||||
{ key: 'right', ctrl: true },
|
||||
{ key: 'right', command: true },
|
||||
{ key: 'f', command: true },
|
||||
],
|
||||
[Command.DELETE_CHAR_LEFT]: [
|
||||
{ key: 'backspace' },
|
||||
{ sequence: '\x7f' },
|
||||
{ key: 'h', ctrl: true },
|
||||
],
|
||||
[Command.DELETE_CHAR_RIGHT]: [{ key: 'delete' }, { key: 'd', ctrl: true }],
|
||||
[Command.DELETE_WORD_FORWARD]: [
|
||||
{ key: 'delete', ctrl: true },
|
||||
{ key: 'delete', command: true },
|
||||
],
|
||||
|
||||
// Screen control
|
||||
@@ -208,6 +248,8 @@ export const defaultKeyBindings: KeyBindingConfig = {
|
||||
[Command.TOGGLE_COPY_MODE]: [{ key: 's', ctrl: true }],
|
||||
[Command.TOGGLE_YOLO]: [{ key: 'y', ctrl: 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 }],
|
||||
@@ -242,7 +284,14 @@ export const commandCategories: readonly CommandCategory[] = [
|
||||
},
|
||||
{
|
||||
title: 'Cursor Movement',
|
||||
commands: [Command.HOME, Command.END],
|
||||
commands: [
|
||||
Command.HOME,
|
||||
Command.END,
|
||||
Command.MOVE_LEFT,
|
||||
Command.MOVE_RIGHT,
|
||||
Command.MOVE_WORD_LEFT,
|
||||
Command.MOVE_WORD_RIGHT,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Editing',
|
||||
@@ -251,6 +300,11 @@ export const commandCategories: readonly CommandCategory[] = [
|
||||
Command.KILL_LINE_LEFT,
|
||||
Command.CLEAR_INPUT,
|
||||
Command.DELETE_WORD_BACKWARD,
|
||||
Command.DELETE_WORD_FORWARD,
|
||||
Command.DELETE_CHAR_LEFT,
|
||||
Command.DELETE_CHAR_RIGHT,
|
||||
Command.UNDO,
|
||||
Command.REDO,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -334,10 +388,19 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
|
||||
[Command.ESCAPE]: 'Dismiss dialogs or cancel the current focus.',
|
||||
[Command.HOME]: 'Move the cursor to the start 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_WORD_LEFT]: 'Move the cursor one word to the left.',
|
||||
[Command.MOVE_WORD_RIGHT]: 'Move the cursor one word to the right.',
|
||||
[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.CLEAR_INPUT]: 'Clear all text in the input field.',
|
||||
[Command.DELETE_WORD_BACKWARD]: 'Delete the previous word.',
|
||||
[Command.DELETE_WORD_FORWARD]: 'Delete the next word.',
|
||||
[Command.DELETE_CHAR_LEFT]: 'Delete the character to the left.',
|
||||
[Command.DELETE_CHAR_RIGHT]: 'Delete the character to the right.',
|
||||
[Command.UNDO]: 'Undo the most recent text edit.',
|
||||
[Command.REDO]: 'Redo the most recent undone text edit.',
|
||||
[Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.',
|
||||
[Command.SCROLL_UP]: 'Scroll content up.',
|
||||
[Command.SCROLL_DOWN]: 'Scroll content down.',
|
||||
|
||||
Reference in New Issue
Block a user