Reputation: 1020
Google colaboratory is an amazing tool and the only thing that keeps me from using it more often is the absence of vim keybindings. Is there a way to enable it just like its possible to do for jupyter notebooks and jupyter lab?
Upvotes: 27
Views: 19318
Reputation: 6276
The setting is now in: Tools > Keyboard shortcuts. Then select vim in Editor key bindings.
Shortcut: Ctrl-M H
Upvotes: 0
Reputation: 439
It's now available in google colab by default. You can select Vim keybindings from Tools > Settings > Editor, or by typing Ctrl+M H
Upvotes: 37
Reputation: 3919
Due to previous conversation in this posting, I've published autovim
to the Chrome extension store. It works perfectly as far as I have found with permanently visible CodeMirror
elements, but is still flaky with CodeMirror
elements that hide and show like those for Markdown in Jupyter.
https://chrome.google.com/webstore/detail/autovim/licohjbphilmljmjonhiifkldfahnmja
You can contribute here if you desire:
https://github.com/thomcom/autovim
Upvotes: 6
Reputation: 1539
Here is a little hack to enable Vim mode via the JavaScript console. Annoyingly, it needs to be re-run each time a cell is executed, so I've bound ctrl/cmd-enter
and shift-enter
to do just that:
function enable_vim() { document.querySelectorAll(".CodeMirror").forEach(function (e) { e.CodeMirror.setOption("vimMode", true); }); }
document.addEventListener('keydown', function(e) {
if (e.keyCode == 13 && e.metaKey || e.keyCode == 13 && e.shiftKey) {
for (var i = 0; i < 10; i++) setTimeout(enable_vim, 1000 * i);
}
});
enable_vim();
Just be careful to be in normal mode (not in input mode) when running a cell. Otherwise Vim mode will be permanently disabled for that cell and one needs to reload the entire web app to re-enable it.
Upvotes: 9
Reputation: 6625
Not right now; feel free to file an issue at https://github.com/googlecolab/colabtools.
Upvotes: 1