Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from Mar 12, 2023

Conversation

asford
Copy link
Contributor

@asford asford commented Oct 1, 2022

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:

  • Add a line to History.md briefly documenting the change.

If this is a release, additionally do the following:

  • Update the dependencies in package.json
  • Run jlpm install to update yarn.lock

Thanks!

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Binder 👈 Launch a binder notebook on branch asford/jupyterlab-vim/leave_current_mode

@asford asford mentioned this pull request Oct 1, 2022
3 tasks
Copy link
Collaborator

@ianhi ianhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this @asford - this is a nice addition!

a few comments on the code if you have the time to address but otherwise looks good.

I also kind of like having equivalent behavior available for i - so i can take you from jupyter command mode -> normal mode -> edit mode. What do you think about that?

src/labCommands.ts Outdated Show resolved Hide resolved
src/labCommands.ts Outdated Show resolved Hide resolved
Co-authored-by: Ian Hunt-Isaak <ianhuntisaak@gmail.com>
@peytondmurray
Copy link
Contributor

peytondmurray commented Feb 12, 2023

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.

src/labCommands.ts Outdated Show resolved Hide resolved
@krassowski krassowski merged commit bdcebe3 into jupyterlab-contrib:master Mar 12, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants