Skip to main content

jupyterlab-vimrc

Github Actions Status

add a basic vimrc to jupyterlab + support for yanking to the system clipboard.

I also recommend:

Install

# for jlab 3+
pip install jupyterlab-vimrc

or for jupyterlab=2

jupyter labextension install jupyterlab-vimrc@0.3.0

Basic Usage

You can modify the contents of this psuedo vimrc by editing the settings using Settings > Advanced Settings Editor (Ctrl+,) and selecting the settings for vimrc. Commands are defined as arrays with the syntax: [lhs, rhs]. For example you can map ii to <Esc> in insert mode by adding the following to the settings:

{
"imap": 
    [
        ["ii", "<Esc>"],
    ],
}

See the Examples for other premade settings files such as hjkl -> jkl;

Supported Commands

Currently supports these commands:

imap
nmap
vmap
inoremap*
nnoremap*
vnoremap*

* noremap caveat

The noremap commands are also availiable but come with several caveats:

The comment for the noremap function in codemirror/keymap/vim.js says the following:

Non-recursive map function.
NOTE: This will not create mappings to key maps that aren't present in the default key map. See TODO at bottom of function.

My reading of this comment and looking through the actual function leads me to believe that the restrictions are:

  1. The right hand side of the mapping must be defined in the default vim.js keymap
  2. The default keymap must not be an [Ex to Ex] or [Key to Key] mapping.

The result will then be that you have changed the lhs for the default keymapping but nothing else. If your mapping doesn't meet these conditions then the mapping will not be performed and this extension will put an error message in the console. So it may be in your best interest to just use the map commands and be careful to not get caught in infinite mapping loops.

Requirements

  • JupyterLab >= 3.0 (pip install jupyterlab-vimrc)
  • JupyterLab >= 2.0 (jupyter labextension install jupyterlab-vimrc@0.3.0)
  • JupyterLab >= 1.0 (jupyter labextension install jupyterlab-vimrc@jlab1)

Contributing

Development install

Note: You will need NodeJS to build the extension package.

conda install -c conda-forge nodejs

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyterlab-vimrc directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

Uninstall

pip uninstall jupyterlab-vimrc
jupyter labextension uninstall jupyterlab-vimrc

Metadata

Release files for jupyterlab-vimrc 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterlab-vimrc 0.5.2
File Size Uploaded
jupyterlab-vimrc-0.5.2.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterlab-vimrc 0.5.2
File Interpreter ABI Platform
jupyterlab_vimrc-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / jupyterlab-vimrc-0.5.2.tar.gz

Download URL jupyterlab-vimrc-0.5.2.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f52b083c748f3a5ece56b509e2a5b7055686cde52fa75f9782deffbc60989cfa
BLAKE2b-256 checksum
How to use checksums
6991701aa1c28aa4c3a7a99a69e4d5ffd47f06b56d841f267e20977337dac0e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

Release files / jupyterlab_vimrc-0.5.2-py3-none-any.whl

Download URL jupyterlab_vimrc-0.5.2-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3891af8169479f73362cf4167ae4485aee4a3be82369f7c4f23f45b586ebfff1
BLAKE2b-256 checksum
How to use checksums
3c17cc7c3724cf5b5830009b355a343063f8ee7bb762555022c6b17ade44076c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.4.2

1 release file

0.4.1

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page