Bug report for Colab: http://colab.research.google.com/.
For questions about colab usage, please use stackoverflow.
Describe the current behavior:
Cannot exit cell after choosing vim editor mode (described here #59).
Describe the expected behavior:
There should be a shortcut (e.g. Shift+Esc) to leave the current cell.
The web browser you are using (Chrome, Firefox, Safari, etc.):
Chrome
Hey! Thanks for filling feedback and using Vim mode!
Just to be super clear about the bug, is the desired end state that a shortcut (like Shift+Esc) leaves the editor, and puts focus on the cell as a whole?
You can see the different focus levels by doing the following:
Loading up the welcome notebook (or any notebook), you're dropped into "cell" level focus. The editor is not shown, and up/down keys hop between cells.
Pressing "enter" will drop you into "editor" mode, where the code / markdown editor is shown.
With default keyboard shortcuts, I believe Esc will leave editor mode, and return to cell mode. With Vim, what I observe is that no such equivalent exists, thus the need for Shift+Esc.
Let me know if I'm reading into it correctly.
Yes, you are 100% correct.
You described the issue much better than I ever could 馃槃
Currently the only way I see to exit Insert mode (and go to Normal (Vim) mode) is by running an :imap <Something> <Esc> command before going into insert for the first time (but this seems to be needed after each page reload).
Something else that would be nice is to have something like a .vimrc file, or at least a memory of the commands that have been run (e.g. remappings), and mappings such as :nnoremap <A> <B> (non-recursive, in the case of wanting to switch the functionality of two keymappings).
@ZacMonroe I can exit Insert and move to Normal by hitting Esc. I think this issue talks about an extra mode, "cell level", which allows manipulation at cell level using the keybindings (select, move, merge, etc...). A similar 3-mode is present in Jupyter-Vim-Binding https://github.com/lambdalisue/jupyter-vim-binding
For people looking to exit to cell level in colab using the vim mode, what I do is use Ctrl-N (key binding for Next Cell, you can customize in the Ctrl-M, H panel) that takes the mode to cell level.
@ddalex, like @katlyn-edwards, you described the issue much better than I ever could 馃槃
In addition to Jupyter-Vim-Binding, the 3 modes (outside Vim mode, normal inside, insert inside) are also present in jupyterlab-vim. Both use Shift+Esc to exit Vim mode.
Ctrl-N indeed moves me to the next cell, but it only works consistently in insert mode and I have to be in the last line in the cell and it only sometimes takes me out of Vim mode. I found out that I can also move to previous cell with Ctrl-p, but similarly it only works consistently in insert mode and I have to be in the first line in the cell and it only sometimes takes me out of Vim mode.
do we have a fix for this?
I am loving VIM mode, bu I am unable to move out of VIM to cell mode.
Totally agree to add a way to exit focus a cell with vim mode.
While using vim, only ESC can not exit to not-in-a-cell status.
Another vote to ask for a fix> I also cannot figure out how to exit "Normal" mode into "cell mode to navigate to different cells. If anyone knows of hack lemme know. Even using CTRL-M-A to try to add another cell automatically drops me in "Normal" mode -cheers.
the same issue with me. Is there a short cut to move focus between cells, create new cells, and delete cells.
Here is a console/javascript hack to change keyboard F2 into a way to remove focus (blur) from a VIM cell in colab (if you find yourself stuck in a cell and want out, hit F2)
function release2(e){
if(e.keyCode == 113){
document.activeElement.blur()
}
}
document.addEventListener('keydown', release2);
reference: https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event
https://docs.cypress.io/api/commands/blur.html#Syntax
@lun-moon blur() didn't work for me.
But this double combo works for me: ctrl+click and then arrow up. That always takes me to the cell mode.
But so far I was not able to create a JS snippet that would simulate this behavior.
@katlyn-edwards any updates?
Shift+Esc please!
Trying to set Unfocus Current Cell to Shift+Esc manually, gives: Ignoring protected or invalid key sequence Shift+Esc.
This is a separate issue, but in vim-mode one expects O/o for new cell above/below. Forcing Ctrl+m a/b in cell-level normal mode is monstrous.
Please see https://github.com/lambdalisue/jupyter-vim-binding for inspiration 馃檹
Please see https://github.com/lambdalisue/jupyter-vim-binding for inspiration 馃檹
The JupyterLab equivalent of the jupyter-vim-binding extension is https://github.com/jwkvam/jupyterlab-vim
Both Jupyter extensions use Shift-Esc to go from Jupyter edit mode to Jupyter command mode.
Most helpful comment
Hey! Thanks for filling feedback and using Vim mode!
Just to be super clear about the bug, is the desired end state that a shortcut (like Shift+Esc) leaves the editor, and puts focus on the cell as a whole?
You can see the different focus levels by doing the following:
Loading up the welcome notebook (or any notebook), you're dropped into "cell" level focus. The editor is not shown, and up/down keys hop between cells.
Pressing "enter" will drop you into "editor" mode, where the code / markdown editor is shown.
With default keyboard shortcuts, I believe Esc will leave editor mode, and return to cell mode. With Vim, what I observe is that no such equivalent exists, thus the need for Shift+Esc.
Let me know if I'm reading into it correctly.