Closed petergthatsme closed 11 months ago
Thanks for reporting! It would be huge bummer if that is non-configurable as it would require retraining muscle memory.
Fortunately this is already configurable on our side. If you go to the json settings editor for keyboard shortcuts then you can define a new shortcut for leaving vim mode to go into notebook command mode. For example:
{"shortcuts":[
{
"args": {},
"selector": ".jp-NotebookPanel[data-jp-vim-mode='true'] .jp-Notebook.jp-mod-editMode",
"keys": ["Ctrl Escape"],
"command":"notebook:enter-command-mode"
}
]
}
will make Ctrl-Esc
enter jupyter command mode
for reference the extension defines this here: https://github.com/jupyterlab-contrib/jupyterlab-vim/blob/a17e9e0566b68e038c340c8b901ca5301d0020f8/schema/plugin.json#L108-L112
More details on customizing keymaps here: https://github.com/jupyterlab-contrib/jupyterlab-vim/blob/master/modify-keybinds.md
Thanks very much for your quick answer @ianhi. Yeah, it would be great if the plugin could overwrite firefox's binding as shift+escape seems a bit more natural to me (muscle memory, i guess), but not clear if that's even possible, or if firefox fights tooth and nail to prevent that (i.e., potential security risk?)
In any case setting ctrl+escape as as you suggest, also works fine... thanks again, this "bug" can be closed.
Minor point: you have a typo in your code snippet: "Crtl Escape" should read "Ctrl Escape".
Minor point: you have a typo in your code snippet: "Crtl Escape" should read "Ctrl Escape".
Thanks - fixed.
There is also the proposed using of Esc
to do double duty: https://github.com/jupyterlab-contrib/jupyterlab-vim/pull/70
In fairness to firefox shift-esc
may be a reasonably obscure keybinding to have chosen - https://xkcd.com/1172/
@ianhi Since Shift+Esc is now the task/process manager shortcut for both Firefox and Chrome (I don't know when it was introduced in Chrome), I'm wondering if the default jupyterlab-vim shortcut for entering command mode should be changed to something else. Thoughts?
EDIT: Ctrl+Esc in Windows brings up the Start menu, so that doesn't seem like a good default either. The other combinations of Esc on Windows correspond to arrangement of windows. I'm out of ideas for now.
Interestingly I've found in firefox that when im in normal mode shift-esc
still works but if i hit it twice i end up in the task manager, But I agree that this has become untenable. I think that having esc
also go from normal mode to jupyter command mode is probably the best solution. But I'd be curious what other users think?
The other combinations of Esc on Windows correspond to arrangement of windows. I'm out of ideas for now.
Given this I think we cannot use combos of esc
, but I suspect esc
will never be pre-empted by the browser.
pinging a few people who's names I've seen several times. Still a shame that there's no general way to query the community of users for this.
@mlucool @lukashergt @petergthatsme @banderlog
Well, personally I see no problem here.
Shift-Esc
still works, it calls browser Manager only on second press.
I never or rarely need to exit vim mode. Most f the times I just need to exit Insert mode with Esc
. And I do not want it to be remapped by default ¯\_(ツ)_/¯
Please share, why you need to exit vim mode completely, I am curious
Well, I constantly switch between jupyter and vim mode, so I use Shift-Esc
a lot. I'm glad it works, but I do wish I didn't need to constantly close the accidentally opened browser manager.
Since Shift-Esc
works in vim mode, I wonder whether we could simply create a Shift-Esc
command in jupyter mode that does nothing, which then might override the firefox/chrome command.
Please share, why you need to exit vim mode completely, I am curious
I navigate around the notebook in jupyter mode.
Shift-Esc command in jupyter mode that does nothing, which then might override the firefox/chrome command.
oooh that sounds like it would plausibly fix things
Shift-Esc command in jupyter mode that does nothing, which then might override the firefox/chrome command.
oooh that sounds like it would plausibly fix things
Confirmed that adding the command mode selector to the shortcut (see below) would override the task/process manager shortcut. It probably shouldn't be the default though.
{
"command": "notebook:enter-command-mode",
"keys": [
"Shift Escape"
],
"selector": ".jp-Notebook.jp-mod-commandMode",
"args": {},
}
It probably shouldn't be the default though.
Why not? Seems to me that this solves a problem popping up for lots of users and doesn't harm anything when not fixing that (aside from blockign the task-manager I guess)
I would make it the default.
There have been wishes for firefox to make their shortcuts customisable to not interfere with other programs' shortcuts, but from their perspective I can see them saying: "If you want to use that shortcut for something else, you have the right to overwrite it." (which we have already done in vim mode...)
If people still want to access their browser manager, simply open a new tab and press Shift-Esc
...
I also second the above comments - it would be great to have this workaround implemented as a default. As nicely pointed out by @lukashergt it would still be very straightforward to access the browser manager in a simple way with the shortcut that the firefox devs put in.
this is release in 4.0.2 on pypi and likely on conda-forge tomorrow
btw, guys, how enter VIM mode back after I exit it? It looks like it left only inside cells
I'm not sure I understand, @banderlog. I use jupyter mode to navigate between cells. I then use Enter
to enter a cell in vim mode. i
gets you into insert mode. Esc
gets you back to vim mode. Shift+Esc
gets you back into jupyter mode.
@lukashergt I am telling about state when vim bindings for Cut/Copy/Paste Cell work. Because I have weird situation when vim bindings inside cells work, but vim bindings for cell manipulation not(
Might be better to open an issue and be very specific about what doesn't work. I think what you are referring to is what I call jupyter mode, where I navigate between cells with j
and k
, center on a cell with zz
, cut a cell with x
, etc. Most vim bindings work for me, not sure which vim bindings you are talking about that don't work.
The latest Firefox (>= 108.0) implements a new functionality where shift+escape now brings up their process manager. This breaks jupyterlab-vim (i.e. pressing one two many times, triggers Firefox's binding)
I commented on a bug report with them (see here: https://bugzilla.mozilla.org/show_bug.cgi?id=1806272) - it seems like this new "feature" also breaks how discord works. I am not sure if anything will be done about it from Mozilla's side, so hoping there is maybe an easy workaround directly in jupyterlab-vim?
thanks