jupyterlab-contrib / jupyterlab-vim

Vim notebook cell bindings for JupyterLab
https://jupyterlab-contrib.github.io/jupyterlab-vim.html
MIT License
661 stars 43 forks source link

Add "leave-current-mode" command to move insert->normal->command. #69

Closed asford closed 1 year ago

asford commented 1 year ago

As we know, jupyterlab is already a "modal" editor and (by default) has a "edit4" and "command" mode. One switches between modes via Esc, a la vim.

It's rather nice to preserve this behavior when adding the vim-modes so that Esc conceptually moves "up" a mode, from vim-insert/lvisual to vim-normal and from vim-normal to jupyterlab-command.

Add a "Leave Current Mode" command, which can be rebound to Esc rather than "Leave Insert Mode".

This PR does not change the default Esc binding, which is separately proposed in #70.

Please finish the following when submitting a pull request:

If this is a release, additionally do the following:

Thanks!

github-actions[bot] commented 1 year ago

Binder :point_left: Launch a binder notebook on branch _asford/jupyterlab-vim/leave_currentmode

peytondmurray commented 1 year ago

Hmm, I was just testing this out but was unable to find the leave-current-mode option in the Keyboard Shortcuts section of the Advanced Settings Editor. I did a pip install . inside the base of this repo on this branch. What am I missing? I can see leave-insert-mode...

EDIT: Okay, I think I might not be able to see this because it's not part of plugin.json, even though it's been added to the command registry. Please disregard the comment above.