jwkvam/jupyterlab-vim

Cannot assign custom shortcut to "Enter Command Mode"

llinfeng opened this issue · 2 comments

By default, Jupyter maps Shift + ESC to issue command "Enter Command Mode". I was remapping the function/method by adding the following to the src/index.ts file, but it is no longer working.

        commands.addKeyBinding({
            selector: '.jp-Notebook.jp-mod-edit Mode',
            keys: ['Ctrl Shift E'],
            command: 'notebook:enter-command-mode'
        });

For the specific key-mapping, I have tried Ctrl ], Ctrl Shift ] and the current one Ctrl Shift E Yet, none of these works. Although I see the mapping through the "control panel" (or maybe it has a better name) below, Shift + ESC is still doing its job in Chrome.
image

I have tried to start all over with a fresh conda environment, and can only get Shift + ESC to work with Chrome. It is not working in Firefox (both locally launched or through visiting the localhost via SSH-port-forwarding).

Please advise if there is a better way to specify the mapping for command "Enter Command Mode". I would like to avoid using Shift + ESC as it will summon the "Task Manager" when pressed in command mode.

Have you tried rebuilding the package after making those edits? I have the enter-command-mode changed to 'Escape' and it works fine.

As directed by https://github.com/jwkvam/jupyterlab-vim
Do the following in the repository directory.
jlpm run build
jupyter lab build

Glad that rebuilding the package works for you and that remapping it to <ESC> shall work nicely. I will mark this issue as closed, then.

I ended up using Autohotkey to remap other keys to Shift+ESC, as I find it a bit cumbersome to maintain the src/index.ts file across multiple servers. Here are my current mappings through AHK, where ahk_group JupyterLab is declared in the "auto-execute" section of the main script.

#IfWinActive ahk_group JupyterLab
    ^]:: send +{ESC}
    ^/:: send ^{NumpadDiv}
#IfWinActive