jupyterlab-emacskeys
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

jupyterlab-emacskeys

npm version Build Status npm downloads

Currently JupyterLab seems to support emacs keybindings only in its text editor, but not in the notebook cells. This might be simply a bug (actually it seems to be intentional - see #3885), as changing the default config in codemirror would help, but until it is fixed, I'm using this method of changing the default keymap in codemirror to emacs.

Origin

I was badly missing the emacs keybindings support in the notebook cells in the current version of JupyterLab, and as I was not familiar with the jupyter development environment, I've just forked the jwkvam/jupyterlab-vim repo and adapted it to simply use keyMap=emacs in codemirror.

Install

Prerequisites

  • JupyterLab 1.0.1

Install or upgrade

jupyter labextension install jupyterlab-emacskeys

Tweaks

Because some common emacs keybindings are already reserved in jupyter-lab, you will have to disable them like this (see issue #1), i.e.:

{

    "shortcuts": [
        {
            "command": "application:toggle-left-area",
            "keys": [
                "Accel B"
            ],
            "selector": "body",
            "disabled": true
        },
        {
            "command": "application:close",
            "keys": [
                "Alt W"
            ],
            "selector": ".jp-Activity",
            "disabled": true
        },
        {
            "command": "notebook:split-cell-at-cursor",
            "keys": [
                "Ctrl Shift -"
            ],
            "selector": ".jp-Notebook.jp-mod-editMode",
            "disabled": true
        },
        {
            "command": "apputils:print",
            "keys":["Accel P"],
            "selector": "body",
            "disabled": true
        },
        {
            "command": "documentsearch:start",
            "keys": [
                "Accel F"
            ],
            "selector": ".jp-mod-searchable",
            "disabled": true
        },
    ]
}

And because Chrome or Firefox tend to capture some shortcuts, it might help setting the Emacs key-theme for all GTK applications like this:

gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"

or by editing ~/.config/gtk-3.0/settings.ini like this:

[Settings]
gtk-key-theme-name = Emacs

Uninstall

jupyter labextension uninstall jupyterlab-emacskeys

Development

For a development install (requires npm version 4 or later), do the following in the repository directory:

npm install
npm run build
jupyter labextension link .

To rebuild the package and the JupyterLab app:

npm run build
jupyter lab build

Package Sidebar

Install

npm i jupyterlab-emacskeys

Weekly Downloads

2

Version

0.10.0

License

MIT

Unpacked Size

7.56 kB

Total Files

7

Last publish

Collaborators

  • kpe