Created
November 26, 2022 15:30
-
-
Save cyrillkuettel/55a9feb51c6f2e027ccd9918cc1b0936 to your computer and use it in GitHub Desktop.
Demonstrates how to inject custom vim settings in CodeMirror 6 Editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Overleaf Custom Vim bindings | |
// @match https://www.overleaf.com/project/* | |
// @version 0.1 | |
// @description Injecting custom vim settings in overleaf project. CodeMirror 6 editor only. | |
// @author cyrillkuettel | |
// @match https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo/related?hl=de | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.addEventListener('UNSTABLE_editor:extensions', (event) => { | |
const retry = setInterval(() => { | |
//console.log(event); | |
const { CodeMirrorVim, extensions } = event.detail | |
if (CodeMirrorVim.Vim == undefined) { | |
return; | |
} | |
CodeMirrorVim.Vim.map('jk', '<Esc>', 'insert') | |
console.log("Custom key bindings applied") | |
}, 100); | |
}) | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use
Note: The api is unstable and subject to change.