Let Vim insert mode escape (esc) to normal mode even if suggestion dropdown open

Well this modification of your code seems to work in making Shift+Esc close the suggestion pop-up without getting out of insert mode. But I’m not familiar at all with the Obsidian API…

<%*
// 2025-08-17 https://forum.obsidian.md/t/let-vim-insert-mode-escape-esc-to-normal-mode-even-if-suggestion-dropdown-open/35414/18
const scope = app.workspace.editorSuggest.suggests[0].scope;
const escKey = scope.keys.find(key => key.key === 'Escape' && key.modifiers === '');
const oldEscFunc = escKey.func;
// The void allows the event to propagate up to the Vi handler and get out of normal mode
escKey.func = () => void oldEscFunc();

const shiftEscKey = scope.keys.find(key => key.key === 'Escape' && key.modifiers?.length == 1 && key.modifiers[0] === 'Shift');
if (shiftEscKey) {
    // 2025-08-19 Untested path
    const oldShiftEscFunc = shiftEscKey.func;
    shiftEscKey.func = () => { oldEscFunc(); return oldShiftEscFunc(); }
} else {
    scope.register(["Shift"], "Escape", () => oldEscFunc());
}
-%>
1 Like