How to use the monaco-vim.VimMode function in monaco-vim

To help you get started, we’ve selected a few monaco-vim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattgodbolt / compiler-explorer / static / panes / editor.js View on Github external
Editor.prototype.onInsertKey = function (event) {
    if (this.editor.vimInUse) {
        var currentState = monacoVim.VimMode.Vim.maybeInitVimState_(this.vimMode);
        if (!currentState.insertMode) {
            var insertEvent = {};
            insertEvent.preventDefault = event.preventDefault;
            insertEvent.stopPropagation = event.stopPropagation;
            insertEvent.browserEvent = {};
            insertEvent.browserEvent.key = 'i';
            insertEvent.browserEvent.defaultPrevented = false;
            insertEvent.keyCode = 39;
            this.vimMode.handleKeyDown(insertEvent);
        }
    }
};
github mattgodbolt / compiler-explorer / static / panes / editor.js View on Github external
Editor.prototype.onEscapeKey = function () {
    if (this.editor.vimInUse) {
        var currentState = monacoVim.VimMode.Vim.maybeInitVimState_(this.vimMode);
        if (currentState.insertMode) {
            monacoVim.VimMode.Vim.exitInsertMode(this.vimMode);
        } else if (currentState.visualMode) {
            monacoVim.VimMode.Vim.exitVisualMode(this.vimMode, false);
        }
    }
};

monaco-vim

Vim keybindings for monaco-editor

MIT
Latest version published 12 months ago

Package Health Score

64 / 100
Full package analysis

Popular monaco-vim functions