Skip to content

Instantly share code, notes, and snippets.

@hankyates
Created January 27, 2014 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hankyates/8655996 to your computer and use it in GitHub Desktop.
Save hankyates/8655996 to your computer and use it in GitHub Desktop.
Vim
var vimBinding = document.createElement('script');
vimBinding.setAttribute('src','https://raw.github.com/marijnh/CodeMirror/master/keymap/vim.js');
var mirrors = document.querySelectorAll('.CodeMirror');
// browser support for onload may be iffy ...
vimBinding.onload = function () {
Array.prototype.forEach.call(mirrors, function (instance){
instance.CodeMirror.setOption('keyMap','vim');
});
};
document.body.appendChild(vimBinding);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment