diff --git a/src/renderer/components/dock/terminal.ts b/src/renderer/components/dock/terminal.ts index 6de16721d6..7d8c19b8f6 100644 --- a/src/renderer/components/dock/terminal.ts +++ b/src/renderer/components/dock/terminal.ts @@ -6,6 +6,7 @@ import { dockStore, TabId } from "./dock.store"; import { TerminalApi } from "../../api/terminal-api"; import { themeStore } from "../../theme.store"; import { autobind } from "../../utils"; +import { isMac } from "../../../common/vars"; export class Terminal { static spawningPool: HTMLElement; @@ -182,7 +183,7 @@ export class Terminal { }; keyHandler = (evt: KeyboardEvent): boolean => { - const { code, ctrlKey, type } = evt; + const { code, ctrlKey, type, metaKey } = evt; // Handle custom hotkey bindings if (ctrlKey) { @@ -199,6 +200,15 @@ export class Terminal { } } + //Ctrl+K: clear the entire buffer, making the prompt line the new first line on mac os + if (isMac && metaKey) { + switch (code) { + case "KeyK": + this.onClear(); + break; + } + } + // Pass the event above in DOM for to handle common actions if (!evt.defaultPrevented) { this.elem.dispatchEvent(new KeyboardEvent(type, evt));