diff --git a/src/views/PromptComponent.tsx b/src/views/PromptComponent.tsx index 6c49c2169..d1edfc864 100644 --- a/src/views/PromptComponent.tsx +++ b/src/views/PromptComponent.tsx @@ -82,6 +82,30 @@ export class PromptComponent extends React.Component { () => this.setNextHistoryItem(), "!suggestWidgetVisible", ); + this.addShortcut( + monaco.KeyMod.WinCtrl | monaco.KeyCode.KEY_B, + "cursorLeft", + ); + this.addShortcut( + monaco.KeyMod.Alt | monaco.KeyCode.KEY_B, + "cursorWordStartLeft", + ); + this.addShortcut( + monaco.KeyMod.WinCtrl | monaco.KeyCode.KEY_F, + "cursorRight", + ); + this.addShortcut( + monaco.KeyMod.Alt | monaco.KeyCode.KEY_F, + "cursorWordEndRight", + ); + this.addShortcut( + monaco.KeyMod.WinCtrl | monaco.KeyCode.KEY_W, + "deleteWordLeft", + ); + this.addShortcut( + monaco.KeyMod.Alt | monaco.KeyCode.KEY_D, + "deleteWordRight", + ); this.focus(); } @@ -217,4 +241,12 @@ export class PromptComponent extends React.Component { private triggerSuggest() { this.editor.trigger(this.editor.getValue(), "editor.action.triggerSuggest", {}); } + + private addShortcut(keybinding: number, handlerId: string) { + this.editor.addCommand( + keybinding, + () => this.editor.trigger("", handlerId, {}), + "", + ); + } }