Skip to content

Instantly share code, notes, and snippets.

@geecu
Created April 24, 2014 08:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geecu/11246089 to your computer and use it in GitHub Desktop.
Save geecu/11246089 to your computer and use it in GitHub Desktop.
Enable vim mode for <textarea>s in a page
// add our keyamp from github
var vimBinding = document.createElement('script');
vimBinding.setAttribute('src', 'https://rawgit.com/jakub-m/vim-in-textarea/master/jsvim.js');
// browser support for onload may be iffy ...
vimBinding.onload = function () {
var vim = new VIM();
Array.prototype.forEach.call(document.querySelectorAll('textarea'), function (instance){
vim.attach_to(instance);
});
};
document.body.appendChild(vimBinding);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment