Open marskar opened 5 years ago
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.
Another person that wants this. What I've been doing is creating a new cell either above or below and converting it to a text cell with Ctrl+M M, to avoid touching the mouse. Quite monstruous, but at least works.
This is essential for development.
Just wanted to share Ctrl-M + ESC since I didn't see any mention. This enter Cell-Level mode from both Insert- or Normal-Mode, where j and k navigate cells as up and down. Maybe this is good enough as Shift-ESC but for me a simpler shortcut would be ideal. Cheers.
Hi, after trolling around in the interface for solutions, I found a quick fix.
Bad news: The problem is obviously (I think, don't quote me :) that the binding for leaving cell editing is bound to escape, which never gets triggered when you are using vim mode.
Good news: This action can be changed to some other key or key combination.
Steps for quick fix:
Ctrl + M H
(to bring up the key binding help)Unfocus current cell
(this should be bound to Esc
)Ctrl + Esc
(PS: Shift + Esc
does not work for some reason)The name of the action is slightly confusing since it says Unfocus current cell
, but what should happen after you do this is:
Ctrl + Esc
to leave editing mode, but retain focus on the cell
Maybe a good permanent fix for this would be to just set this as the default keybinding when in vim mode.
Anyone know where the vim-logic resides within this repo?
I just noticed that CTRL-M
+ J
and CTRL-M
+ K
works just nicely. BUT, it would still be better to press some short cut to go to a cell navigation mode. Ctrl-M
+ ESC
did not work for me.
Anyone know where the vim-logic resides within this repo?
https://github.com/brijeshb42/monaco-vim is the library we use.
https://github.com/brijeshb42/monaco-vim is the library we use.
Ok, created an upstream issue. LMK if it doesn't make sense. https://github.com/brijeshb42/monaco-vim/issues/88
Replied with a solution
Since there's already a solution from the upstream, how do we fix the issue in colab?
Hi, I still see the same behavior in colab. How can I apply the solution?
Any idea if this has been fixed? I still cannot exit the cell from the vim keybindings
A simple workaround here.
Remapped Unfocus current cell
action from Esc
to Ctrl+M C
and it worked very well.
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