|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export enum Command { |
|
|
|
|
|
RETURN = 'return', |
|
|
ESCAPE = 'escape', |
|
|
|
|
|
|
|
|
HOME = 'home', |
|
|
END = 'end', |
|
|
|
|
|
|
|
|
KILL_LINE_RIGHT = 'killLineRight', |
|
|
KILL_LINE_LEFT = 'killLineLeft', |
|
|
CLEAR_INPUT = 'clearInput', |
|
|
|
|
|
|
|
|
CLEAR_SCREEN = 'clearScreen', |
|
|
|
|
|
|
|
|
HISTORY_UP = 'historyUp', |
|
|
HISTORY_DOWN = 'historyDown', |
|
|
NAVIGATION_UP = 'navigationUp', |
|
|
NAVIGATION_DOWN = 'navigationDown', |
|
|
|
|
|
|
|
|
ACCEPT_SUGGESTION = 'acceptSuggestion', |
|
|
COMPLETION_UP = 'completionUp', |
|
|
COMPLETION_DOWN = 'completionDown', |
|
|
|
|
|
|
|
|
SUBMIT = 'submit', |
|
|
NEWLINE = 'newline', |
|
|
|
|
|
|
|
|
OPEN_EXTERNAL_EDITOR = 'openExternalEditor', |
|
|
PASTE_CLIPBOARD_IMAGE = 'pasteClipboardImage', |
|
|
|
|
|
|
|
|
SHOW_ERROR_DETAILS = 'showErrorDetails', |
|
|
TOGGLE_TOOL_DESCRIPTIONS = 'toggleToolDescriptions', |
|
|
TOGGLE_IDE_CONTEXT_DETAIL = 'toggleIDEContextDetail', |
|
|
QUIT = 'quit', |
|
|
EXIT = 'exit', |
|
|
SHOW_MORE_LINES = 'showMoreLines', |
|
|
|
|
|
|
|
|
REVERSE_SEARCH = 'reverseSearch', |
|
|
SUBMIT_REVERSE_SEARCH = 'submitReverseSearch', |
|
|
ACCEPT_SUGGESTION_REVERSE_SEARCH = 'acceptSuggestionReverseSearch', |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface KeyBinding { |
|
|
|
|
|
key?: string; |
|
|
|
|
|
sequence?: string; |
|
|
|
|
|
ctrl?: boolean; |
|
|
|
|
|
shift?: boolean; |
|
|
|
|
|
command?: boolean; |
|
|
|
|
|
paste?: boolean; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type KeyBindingConfig = { |
|
|
readonly [C in Command]: readonly KeyBinding[]; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const defaultKeyBindings: KeyBindingConfig = { |
|
|
|
|
|
[Command.RETURN]: [{ key: 'return' }], |
|
|
|
|
|
[Command.ESCAPE]: [{ key: 'escape' }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.HOME]: [{ key: 'a', ctrl: true }], |
|
|
|
|
|
[Command.END]: [{ key: 'e', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.KILL_LINE_RIGHT]: [{ key: 'k', ctrl: true }], |
|
|
|
|
|
[Command.KILL_LINE_LEFT]: [{ key: 'u', ctrl: true }], |
|
|
|
|
|
[Command.CLEAR_INPUT]: [{ key: 'c', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.CLEAR_SCREEN]: [{ key: 'l', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.HISTORY_UP]: [{ key: 'p', ctrl: true }], |
|
|
|
|
|
[Command.HISTORY_DOWN]: [{ key: 'n', ctrl: true }], |
|
|
|
|
|
[Command.NAVIGATION_UP]: [{ key: 'up' }], |
|
|
|
|
|
[Command.NAVIGATION_DOWN]: [{ key: 'down' }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.ACCEPT_SUGGESTION]: [{ key: 'tab' }, { key: 'return', ctrl: false }], |
|
|
|
|
|
[Command.COMPLETION_UP]: [{ key: 'up' }, { key: 'p', ctrl: true }], |
|
|
[Command.COMPLETION_DOWN]: [{ key: 'down' }, { key: 'n', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Command.SUBMIT]: [ |
|
|
{ |
|
|
key: 'return', |
|
|
ctrl: false, |
|
|
command: false, |
|
|
paste: false, |
|
|
shift: false, |
|
|
}, |
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
[Command.NEWLINE]: [ |
|
|
{ key: 'return', ctrl: true }, |
|
|
{ key: 'return', command: true }, |
|
|
{ key: 'return', paste: true }, |
|
|
{ key: 'return', shift: true }, |
|
|
{ key: 'j', ctrl: true }, |
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
[Command.OPEN_EXTERNAL_EDITOR]: [ |
|
|
{ key: 'x', ctrl: true }, |
|
|
{ sequence: '\x18', ctrl: true }, |
|
|
], |
|
|
|
|
|
[Command.PASTE_CLIPBOARD_IMAGE]: [{ key: 'v', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.SHOW_ERROR_DETAILS]: [{ key: 'o', ctrl: true }], |
|
|
|
|
|
[Command.TOGGLE_TOOL_DESCRIPTIONS]: [{ key: 't', ctrl: true }], |
|
|
|
|
|
[Command.TOGGLE_IDE_CONTEXT_DETAIL]: [{ key: 'g', ctrl: true }], |
|
|
|
|
|
[Command.QUIT]: [{ key: 'c', ctrl: true }], |
|
|
|
|
|
[Command.EXIT]: [{ key: 'd', ctrl: true }], |
|
|
|
|
|
[Command.SHOW_MORE_LINES]: [{ key: 's', ctrl: true }], |
|
|
|
|
|
|
|
|
|
|
|
[Command.REVERSE_SEARCH]: [{ key: 'r', ctrl: true }], |
|
|
|
|
|
|
|
|
[Command.SUBMIT_REVERSE_SEARCH]: [{ key: 'return', ctrl: false }], |
|
|
|
|
|
[Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]: [{ key: 'tab' }], |
|
|
}; |
|
|
|