Vim Mode Help


Hello everyone! :grinning:

I am working on websites that use a custom CMS which uses Code Mirror as it’s web editor. The implementation I am using does NOT have vim key maps setup and I was wondering how I can do that client side through a chrome extension. I thought maybe I could load some css/javascript config files client side and setup vim key mapping to work for me. Can someone point me in the right direction? Or does anyone know what I would need to do to make this happen? Thanks!


You should be able to get at the CodeMirror instance through the CodeMirror property of the editor’s outer DOM node, and then get at the CodeMirror class/constructor/module by taking the constructor property from that. If you then load vim.js, and its dependencies, making sure it gets the original CodeMirror module when it requests its ../lib/codemirror.js dependency, you should be able to set the keymap on the editor instance to vim.