All Projects → brijeshb42 → Monaco Vim

brijeshb42 / Monaco Vim

Licence: mit
VIM keybindings for monaco editor

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Monaco Vim

msgbots
Messenger Bot Simulator ( Rhino )
Stars: ✭ 17 (-87.02%)
Mutual labels:  monaco-editor
Monaco Languageclient
NPM module to connect Monaco editor with language servers
Stars: ✭ 419 (+219.85%)
Mutual labels:  monaco-editor
Notemaster
NoteMaster is an smart minimalistic persistent note-taking app to help boost productivity.
Stars: ✭ 40 (-69.47%)
Mutual labels:  monaco-editor
wide
A lightweight web IDE (mostly a coding editor) based in monaco-editor (with a one-file server made in php). It allows to navigate the server with commands.
Stars: ✭ 42 (-67.94%)
Mutual labels:  monaco-editor
Go Playground
Better Go Playground powered by React and Monaco editor
Stars: ✭ 354 (+170.23%)
Mutual labels:  monaco-editor
Mongood
A MongoDB GUI with Fluent Design
Stars: ✭ 540 (+312.21%)
Mutual labels:  monaco-editor
vite-vue3-lowcode
vue3.x + vite2.x + vant + element-plus H5移动端低代码平台 lowcode 可视化拖拽 可视化编辑器 visual editor 类似易企秀的H5制作、建站工具、可视化搭建工具
Stars: ✭ 1,309 (+899.24%)
Mutual labels:  monaco-editor
Browser Ext Github Monaco
This extension brings the famous Monaco editor to Github
Stars: ✭ 114 (-12.98%)
Mutual labels:  monaco-editor
Form Generator
✨Element UI表单设计及代码生成器
Stars: ✭ 5,522 (+4115.27%)
Mutual labels:  monaco-editor
Vue Eslint Demo
The online demo to check `eslint-plugin-vue`.
Stars: ✭ 29 (-77.86%)
Mutual labels:  monaco-editor
snipp.in
Fast, Light-weight, Notes, Snippet manager and code editor directly inside your browser
Stars: ✭ 151 (+15.27%)
Mutual labels:  monaco-editor
Ngx Monaco Editor
Monaco Editor component for Angular 2 and Above
Stars: ✭ 347 (+164.89%)
Mutual labels:  monaco-editor
Monaco Editor
A browser based code editor
Stars: ✭ 27,382 (+20802.29%)
Mutual labels:  monaco-editor
BlazorMonaco
Blazor component for Microsoft's Monaco Editor which powers Visual Studio Code.
Stars: ✭ 151 (+15.27%)
Mutual labels:  monaco-editor
Monaco Collab Ext
Adds collaborative editing capabilities to the Monaco Editor
Stars: ✭ 83 (-36.64%)
Mutual labels:  monaco-editor
monaco-ace-tokenizer
Syntax highlighting support for additional languages in monaco-editor
Stars: ✭ 59 (-54.96%)
Mutual labels:  monaco-editor
Vue Monaco
MonacoEditor component for Vue.js
Stars: ✭ 471 (+259.54%)
Mutual labels:  monaco-editor
Masscode
A free and open source code snippets manager for developers.
Stars: ✭ 1,878 (+1333.59%)
Mutual labels:  monaco-editor
Orchestra
One language to be RegExp's Successor. Visually readable and rich, technically safe and extended, naturally scalable, advanced, and optimized
Stars: ✭ 103 (-21.37%)
Mutual labels:  monaco-editor
D3 Id3
iD3: an Integrated Development Environment for D3.js
Stars: ✭ 789 (+502.29%)
Mutual labels:  monaco-editor

monaco-vim

Vim keybindings for monaco-editor demo

npm version

Install

Webpack/browserify

npm install monaco-vim
As global

This package will only work when bundled using webpack/browserify or using AMD. Including globally is not possible due to the use of an internal dependency of monaco-editor which is not exposed in the API. Loading 'monaco' globally is also not possible as you'll have to use its loader.js file. If you are using that, then there will be no problem. See AMD.

Usage

import { initVimMode } from 'monaco-vim';

const vimMode = initVimMode(editor, document.getElementById('my-statusbar'))

Here, editor is initialized instance of monaco editor and the 2nd argument should be the node where you would like to place/show the VIM status info.

To remove the attached VIM bindings, call

vimMode.dispose();

Handling key presses

If you would like a particular keypress to not be handled by this extension, add your onKeyDown handler before initializing monaco-vim and call preventDefault() on it. monaco-vim will ignore such events and won't do anything. This can be useful if you want to handle events like running code on CTRL/CMD+Enter which otherwise would have been eaten up by monaco-vim. (Available from v0.0.14 onwards).

AMD

If you are following the official guide and integrating the AMD version of monaco-editor, you can follow this -

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>

<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<div id="status"></div>

<script src="https://unpkg.com/monaco-editor/min/vs/loader.js"></script>
<script>
  require.config({
    paths: {
      'vs': 'https://unpkg.com/monaco-editor/min/vs',
      'monaco-vim': 'https://unpkg.com/monaco-vim/dist/monaco-vim',
    }
  });
  require(['vs/editor/editor.main', 'monaco-vim'], function(a, MonacoVim) {
    var editor = monaco.editor.create(document.getElementById('container'), {
      value: [
        'function x() {',
        '\tconsole.log("Hello world!");',
        '}'
      ].join('\n'),
      language: 'javascript'
    });
    var statusNode = document.getElementById('status');
    var vimMode = MonacoVim.initVimMode(editor, statusNode);

    // remove vim mode by calling
    // vimMode.dispose();
  });
</script>
</body>
</html>

See demo.js for full usage.

If you would like to customize the statusbar or provide your own implementation, see initVimMode's implementation in src/index.js.

Adding custom key bindings

Actual vim implementation can be imported as:

import { VimMode } from 'monaco-vim';

Defining ex mode command

// VimMode.Vim.defineEx(name, shorthand, callback);
VimMode.Vim.defineEx('write', 'w', function() {
  // your own implementation on what you want to do when :w is pressed
  localStorage.setItem('editorvalue', editor.getValue());
});

For advanced usage, refer codemirror. CodeMirror.Vim is available as VimMode.Vim;

This implementaion of VIM is a layer between Codemirror's VIM keybindings and monaco. There may be issues in some of the keybindings, especially those that expect extra input like the Ex commands or search/replace. If you encounter such bugs, create a new issue. PRs to resolve those are welcome too.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].