Enable Vim mode in gist Ace Editor

I wasn't able to get the other two solutions to work. (Nick's Chrome extension still works perfectly for me, though.)

Another solution is to change to vim mode in the settings menu.

To access the settings menu, make sure the ACE editor has focus, and push ctrl+, (Control and Comma).

This will open the menu on the right hand side of the screen. Find the "Keyboard Handler" dropdown and select vim. Push escape or click somewhere off of the settings menu to close it.

vim mode should now be activated.


In the latest version of ace (v1.1.1), vim and emacs bindings come built in. The following works:

editor.setKeyboardHandler("ace/keyboard/vim");

I posted on the ace Google Group (+rep to Harutyun) and received a reply with the following code:

ace.require("ace/lib/net").loadScript("https://rawgithub.com/ajaxorg/ace-builds/master/src-min-noconflict/keybinding-vim.js", 
function() { 
    e = document.querySelector(".ace_editor.ace-github").env.editor; 
    e.setKeyboardHandler(ace.require("ace/keyboard/vim").handler); 
}) 

Which works like a charm (Do note that the version of ace that github uses may change, which may break this).

It's a pain to enter this into the console each time, so I plan on adding it to a greasemonkey script (a chrome plugin might be nice! -- well see).

Update


I've written a small Chrome Extension that enables Vim bindings on most sites Ace.js and CodeMirror. Issues and contributions welcome at the github repo