Emacs keybindings for monaco-editor
npm install monaco-emacs
Emacs key bindings for monaco-editor. Demo.
``sh`
npm install monaco-emacs
#### Webpack/Browserify
`js`
import * as monaco from 'monaco-editor';
import { EmacsExtension } from 'monaco-emacs';
#### Browser
* Add this script in your html - https://unpkg.com/monaco-emacs/dist/monaco-emacs.js.MonacoEmacs
* The extension will be available as on window
`js`
const monaco = window.monaco;
const { EmacsExtension } = window.MonacoEmacs;
#### Code
`js
const editorNode = document.getElementById('editor');
const statusNode = document.getElementById('statusbar');
const editor = monaco.editor.create(editor);
const emacsMode = new EmacsExtension(editor);
emacsMode.onDidMarkChange((ev: boolean) => {
statusNode.textContent = ev ? 'Mark Set!' : 'Mark Unset';
});
emacsMode.onDidChangeKey((str) => {
statusNode.textContent = str;
});
emacsMode.start();
// If you want to remove the attached bindings, call
emacsMode.dispose();
`
#### Unregister default keys
`js
import { unregisterKey } from 'monaco-emacs';
unregisterKey('Tab');
`
#### Get all available mappings
`js
import { getAllMappings } from 'monaco-emacs';
console.log(getAllMappings());
`
#### AMD
If you are following the official guide and integrating the AMD version of monaco-editor, you can follow this -
`html
``
Please report any inconsistencies or missing key bindings.