Browse Source

Overleaf vimrc

master
n0m1s 7 years ago
parent
commit
53fce0127a
1 changed files with 28 additions and 0 deletions
  1. +28
    -0
      overleaf_vimrc.user.js

+ 28
- 0
overleaf_vimrc.user.js View File

@ -0,0 +1,28 @@
// ==UserScript==
// @name Overleaf vimrc
// @namespace fr.homnomnom
// @version 0.1
// @description Custom vimrc for CodeMirror
// @author n0m1s
// @match https://www.overleaf.com/project/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const retry = setInterval(() => {
if (window._debug_editors === undefined) return;
clearInterval(retry);
// get current editor instance
const editor = window._debug_editors[window._debug_editors.length -1];
// vim keyboard plugin
const vimKeyboard = window.ace.require("ace/keyboard/vim");
vimKeyboard.Vim.map(",,", "<Esc>", "insert");
vimKeyboard.Vim.map(".", ":", "normal");
// set the modified keyboard handler for editor
editor.setKeyboardHandler(vimKeyboard.handler);
console.log("Custom key bindings applied");
}, 100);
})();

Loading…
Cancel
Save