Last active
November 15, 2024 17:16
-
-
Save manchitro/e7af536b287b48a47da055c476d9e8b5 to your computer and use it in GitHub Desktop.
Overleaf Editor Custom VIM Keybindings
This file contains hidden or 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 Editor Custom VIM Keybindings | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @match https://www.overleaf.com/project/* | |
| // @grant none | |
| // @description Sazid's .vimrc for overleaf | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| window.addEventListener("UNSTABLE_editor:extensions", (event) => { | |
| const { CodeMirror, CodeMirrorVim, extensions } = event.detail; | |
| // add custom keybindings - insert mode applies on insert | |
| CodeMirrorVim.Vim.map("kj", "<Esc>", "insert"); | |
| // normal mode applies while escaped | |
| CodeMirrorVim.Vim.map("H", "^", "normal"); | |
| CodeMirrorVim.Vim.map("L", "$", "normal"); | |
| // visual mode mappings | |
| CodeMirrorVim.Vim.map("H", "^", "visual"); | |
| CodeMirrorVim.Vim.map("L", "$", "visual"); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment