scmJS docs

api.hotkeys

HotkeyApi

Key combinations, tried before the editor's own and never while a text field has focus.

Members

add

add(combo: string, run: (() => void) | { command: string; }): Disposable;

"Ctrl+Shift+I", "Alt+F9", "F8" — modifiers in any order, then a key name.

api.hotkeys.add("Ctrl+Alt+G", () => api.view.setFlags({ grid: !api.view.flags().grid }));
Try it