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

Custom Key Bindings and Persistence Across Environments #130

Closed
redditur opened this issue Nov 23, 2023 · 1 comment
Closed

Custom Key Bindings and Persistence Across Environments #130

redditur opened this issue Nov 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@redditur
Copy link

It's not clear to me how to apply vim remappings. There's a section here (https://github.com/jupyterlab-contrib/jupyterlab-vim/blob/main/modify-keybinds.md#vim-remappings) suggesting to modify such mappings in the Notebook Vim settings but it's not clear where exactly or what such a modification looks like. I can't find any examples in this repo or elsewhere.

I see this for the Notebook Vim settings:

{
    // Notebook Vim
    // @axlair/jupyterlab_vim:plugin
    // Notebook Vim Settings
    // *****************************

    // Notebook shortcut key bindings for switching from vim Normal mode to Jupyter Command mode
    // [missing schema description]
    "cmdModeKeys": {
        "escToCmdMode": true,
        "shiftEscOverrideBrowser": true
    },

    // Enabled
    // Enable/disable vim extension (may require a page refresh)
    "enabled": true,

    // Enabled in Text Editor
    // Enable/disable vim in text editors (may require a page refresh)
    "enabledInEditors": true,

    // Extra Vim Keybindings
    // [missing schema description]
    "extraKeybindings": []
}

What exactly needs editing here and how, if, for instance, I want to do something simple like ":imap jk "?

It also seems to me that this extension is local to the environment it's installed in. Is it possible to have this extension "globally active" no matter which environment I'm running a notebook within. E.g. notebook extensions in jupyter --data-dir apply wherever a notebook is running. Is there an equivalent? I appreciate this might be a broader jupyterlab question.

@redditur redditur added the enhancement New feature or request label Nov 23, 2023
@firai
Copy link
Collaborator

firai commented Dec 15, 2023

If you go to the Notebook Vim settings in the Settings Editor (as opposed to the advanced JSON Settings Editor), scroll down to Extra Vim Bindings and click Add, you should see the following interface. There are instructions below each textbox about what each field means. If you want to batch-create JSON settings, I would suggest creating one rule using the interface first before going into the JSON Settings Editor to use the first rule as template.

image

Note that remapping j or k in Notebooks is currently not supported and is a known limitation, because the extension is hard-coded to hijack those keys to enable navigation between cells. See #113.

The question/request to have global extensions would need to be filed upstream at the JupyterLab repo.

@firai firai closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants