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 configuration to provide custom keybindings #74

Merged
merged 3 commits into from
Feb 5, 2023
Merged

Add configuration to provide custom keybindings #74

merged 3 commits into from
Feb 5, 2023

Conversation

peytondmurray
Copy link
Contributor

@peytondmurray peytondmurray commented Dec 27, 2022

Summary

This PR allows the user to configure custom Vim-mode keybindings using the advanced settings editor, closing #43.

@mlucool I tested binding m in normal mode to :noh<CR>, and that seems to work. CodeMirror cannot fully emulate Vim, and many keys will collide with browser or JupyterLab keybindings, so for example if you try to bind a command to <Ctrl-/> it will not work. In any case marks are not supported in CodeMirror so m in normal mode should work just fine.

Changes

  • Added the ability to create Vim keybindings in the advanced settings editor
  • Set additionalProperties to false in plugin.json - it isn't being used here
  • Refactored a bit of the logic inside updateSettings which deals with registering/unregistering commands, updating the tracker, and calling modifyCell to make it a bit simpler. This resolves a bug where the first call to updateSettings would succeed, but any subsequent call would not because it would try to re-register commands that were already registered.
  • Updated the build matrix to remove node 12.x, and added node 18.x.
  • My editor automatically runs JSON through jq (to automatically remove trailing , without me having to deal with it) which resulted in some reformatting of plugin.json. If this is a problem I can undo the reformatted lines.

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch peytondmurray/jupyterlab-vim/custom-keybindings

Copy link
Collaborator

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

First pass on code only.

src/codemirrorCommands.ts Outdated Show resolved Hide resolved
src/codemirrorCommands.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@krassowski
Copy link
Collaborator

error playwright@1.29.2: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.22.12"

I would go ahead and drop node 12, it is EOL. Let's add node 16 or 18 to the matrix instead.

@krassowski
Copy link
Collaborator

Looking at Node.js 18 build failure, maybe we should try with 16 for now?

@peytondmurray
Copy link
Contributor Author

Looks like node 16 works, thanks for the commit!

src/codemirrorCommands.ts Outdated Show resolved Hide resolved
src/codemirrorCommands.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @peytondmurray.

@krassowski krassowski merged commit 95da6de into jupyterlab-contrib:master Feb 5, 2023
@peytondmurray peytondmurray deleted the custom-keybindings branch February 14, 2023 17:09
@krassowski krassowski mentioned this pull request Mar 12, 2023
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.

2 participants