jupyterlab-vim-langmap 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jupyterlab_vim_langmap-0.1.0/.copier-answers.yml +17 -0
- jupyterlab_vim_langmap-0.1.0/.gitignore +127 -0
- jupyterlab_vim_langmap-0.1.0/.prettierignore +8 -0
- jupyterlab_vim_langmap-0.1.0/.yarnrc.yml +2 -0
- jupyterlab_vim_langmap-0.1.0/CHANGELOG.md +19 -0
- jupyterlab_vim_langmap-0.1.0/CONTRIBUTING.md +60 -0
- jupyterlab_vim_langmap-0.1.0/LICENSE +29 -0
- jupyterlab_vim_langmap-0.1.0/PKG-INFO +123 -0
- jupyterlab_vim_langmap-0.1.0/README.md +92 -0
- jupyterlab_vim_langmap-0.1.0/RELEASE.md +88 -0
- jupyterlab_vim_langmap-0.1.0/eslint.config.mjs +80 -0
- jupyterlab_vim_langmap-0.1.0/install.json +5 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/__init__.py +16 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/_version.py +4 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/package.json +155 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/schemas/jupyterlab-vim-langmap/package.json.orig +150 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/schemas/jupyterlab-vim-langmap/plugin.json +55 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/static/232.3a830cce50e41a8e.js +6 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/static/261.ddf51921894263e0.js +1 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/static/remoteEntry.ab3889f3dd7f6561.js +1 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/static/style.js +4 -0
- jupyterlab_vim_langmap-0.1.0/jupyterlab_vim_langmap/labextension/static/third-party-licenses.json +16 -0
- jupyterlab_vim_langmap-0.1.0/package.json +150 -0
- jupyterlab_vim_langmap-0.1.0/pyproject.toml +85 -0
- jupyterlab_vim_langmap-0.1.0/schema/plugin.json +55 -0
- jupyterlab_vim_langmap-0.1.0/src/index.ts +156 -0
- jupyterlab_vim_langmap-0.1.0/src/keycodes.ts +236 -0
- jupyterlab_vim_langmap-0.1.0/src/langmap.ts +72 -0
- jupyterlab_vim_langmap-0.1.0/style/base.css +5 -0
- jupyterlab_vim_langmap-0.1.0/style/index.css +1 -0
- jupyterlab_vim_langmap-0.1.0/style/index.js +1 -0
- jupyterlab_vim_langmap-0.1.0/tools/check-langmap.cjs +186 -0
- jupyterlab_vim_langmap-0.1.0/tools/keylog.html +204 -0
- jupyterlab_vim_langmap-0.1.0/tsconfig.json +24 -0
- jupyterlab_vim_langmap-0.1.0/yarn.lock +4471 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: v4.6.5
|
|
3
|
+
_src_path: https://github.com/jupyterlab/extension-template
|
|
4
|
+
advanced: false
|
|
5
|
+
author_email: yvvakimoto@ymail.ne.jp
|
|
6
|
+
author_name: yvvakimoto
|
|
7
|
+
has_ai_rules: false
|
|
8
|
+
has_binder: false
|
|
9
|
+
has_settings: true
|
|
10
|
+
kind: frontend
|
|
11
|
+
labextension_name: jupyterlab-vim-langmap
|
|
12
|
+
project_short_description: Remap vim command-mode keys back to QWERTY positions when
|
|
13
|
+
the OS emulates Dvorak
|
|
14
|
+
python_name: jupyterlab_vim_langmap
|
|
15
|
+
repository: https://github.com/yvvakimoto/jupyterlab-vim-langmap
|
|
16
|
+
test: false
|
|
17
|
+
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
*.bundle.*
|
|
2
|
+
lib/
|
|
3
|
+
node_modules/
|
|
4
|
+
*.log
|
|
5
|
+
.eslintcache
|
|
6
|
+
.stylelintcache
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.ipynb_checkpoints
|
|
9
|
+
*.tsbuildinfo
|
|
10
|
+
jupyterlab_vim_langmap/labextension
|
|
11
|
+
# Version file is handled by hatchling
|
|
12
|
+
jupyterlab_vim_langmap/_version.py
|
|
13
|
+
|
|
14
|
+
# Created by https://www.gitignore.io/api/python
|
|
15
|
+
# Edit at https://www.gitignore.io/?templates=python
|
|
16
|
+
|
|
17
|
+
### Python ###
|
|
18
|
+
# Virtual environments
|
|
19
|
+
.venv
|
|
20
|
+
|
|
21
|
+
# Byte-compiled / optimized / DLL files
|
|
22
|
+
__pycache__/
|
|
23
|
+
*.py[cod]
|
|
24
|
+
*$py.class
|
|
25
|
+
|
|
26
|
+
# C extensions
|
|
27
|
+
*.so
|
|
28
|
+
|
|
29
|
+
# Distribution / packaging
|
|
30
|
+
.Python
|
|
31
|
+
build/
|
|
32
|
+
develop-eggs/
|
|
33
|
+
dist/
|
|
34
|
+
downloads/
|
|
35
|
+
eggs/
|
|
36
|
+
.eggs/
|
|
37
|
+
lib/
|
|
38
|
+
lib64/
|
|
39
|
+
parts/
|
|
40
|
+
sdist/
|
|
41
|
+
var/
|
|
42
|
+
wheels/
|
|
43
|
+
pip-wheel-metadata/
|
|
44
|
+
share/python-wheels/
|
|
45
|
+
.installed.cfg
|
|
46
|
+
*.egg
|
|
47
|
+
MANIFEST
|
|
48
|
+
|
|
49
|
+
# PyInstaller
|
|
50
|
+
# Usually these files are written by a python script from a template
|
|
51
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
52
|
+
*.manifest
|
|
53
|
+
*.spec
|
|
54
|
+
|
|
55
|
+
# Installer logs
|
|
56
|
+
pip-log.txt
|
|
57
|
+
pip-delete-this-directory.txt
|
|
58
|
+
|
|
59
|
+
# Unit test / coverage reports
|
|
60
|
+
htmlcov/
|
|
61
|
+
.tox/
|
|
62
|
+
.nox/
|
|
63
|
+
.coverage
|
|
64
|
+
.coverage.*
|
|
65
|
+
.cache
|
|
66
|
+
nosetests.xml
|
|
67
|
+
coverage/
|
|
68
|
+
coverage.xml
|
|
69
|
+
*.cover
|
|
70
|
+
.hypothesis/
|
|
71
|
+
.pytest_cache/
|
|
72
|
+
|
|
73
|
+
# Translations
|
|
74
|
+
*.mo
|
|
75
|
+
*.pot
|
|
76
|
+
|
|
77
|
+
# Scrapy stuff:
|
|
78
|
+
.scrapy
|
|
79
|
+
|
|
80
|
+
# Sphinx documentation
|
|
81
|
+
docs/_build/
|
|
82
|
+
|
|
83
|
+
# PyBuilder
|
|
84
|
+
target/
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
.python-version
|
|
88
|
+
|
|
89
|
+
# celery beat schedule file
|
|
90
|
+
celerybeat-schedule
|
|
91
|
+
|
|
92
|
+
# SageMath parsed files
|
|
93
|
+
*.sage.py
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# Mr Developer
|
|
103
|
+
.mr.developer.cfg
|
|
104
|
+
.project
|
|
105
|
+
.pydevproject
|
|
106
|
+
|
|
107
|
+
# mkdocs documentation
|
|
108
|
+
/site
|
|
109
|
+
|
|
110
|
+
# mypy
|
|
111
|
+
.mypy_cache/
|
|
112
|
+
.dmypy.json
|
|
113
|
+
dmypy.json
|
|
114
|
+
|
|
115
|
+
# Pyre type checker
|
|
116
|
+
.pyre/
|
|
117
|
+
|
|
118
|
+
# End of https://www.gitignore.io/api/python
|
|
119
|
+
|
|
120
|
+
# OSX files
|
|
121
|
+
.DS_Store
|
|
122
|
+
|
|
123
|
+
# Yarn cache
|
|
124
|
+
.yarn/
|
|
125
|
+
|
|
126
|
+
# local logic-check output
|
|
127
|
+
.check-build/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!-- <START NEW CHANGELOG ENTRY> -->
|
|
4
|
+
|
|
5
|
+
## 0.1.0
|
|
6
|
+
|
|
7
|
+
First release.
|
|
8
|
+
|
|
9
|
+
- Remap vim Normal / Visual / operator-pending keys back to QWERTY physical
|
|
10
|
+
positions via `Vim.langmap()`, without touching text input, the Ex and search
|
|
11
|
+
prompts, or the character arguments of `f` / `r` / `m` / registers.
|
|
12
|
+
- Remap JupyterLab's own keybindings (Jupyter Command mode, the command
|
|
13
|
+
palette, menu mnemonics) by swapping the `@lumino/keyboard` layout.
|
|
14
|
+
- Built-in Dvorak preset, plus a `langmap` setting accepting any vim
|
|
15
|
+
`langmap` string.
|
|
16
|
+
- `remapCtrl` to include or exclude Ctrl/Alt/Meta combinations, and separate
|
|
17
|
+
switches for the vim and JupyterLab halves.
|
|
18
|
+
|
|
19
|
+
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development install
|
|
4
|
+
|
|
5
|
+
Note: You will need Node.js to build the extension package.
|
|
6
|
+
You may install it from [nodejs.org](https://nodejs.org/en/download). We
|
|
7
|
+
recommend using the latest LTS version of Node.js.
|
|
8
|
+
|
|
9
|
+
The `jlpm` command is JupyterLab's pinned version of
|
|
10
|
+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
|
|
11
|
+
`yarn` or `npm` in lieu of `jlpm` below.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Clone the repo to your local environment
|
|
15
|
+
# Change directory to the jupyterlab_vim_langmap directory
|
|
16
|
+
|
|
17
|
+
# Set up a virtual environment and install package in development mode
|
|
18
|
+
python -m venv .venv
|
|
19
|
+
source .venv/bin/activate
|
|
20
|
+
pip install --editable "."
|
|
21
|
+
|
|
22
|
+
# Link your development version of the extension with JupyterLab
|
|
23
|
+
jupyter-builder develop . --overwrite
|
|
24
|
+
|
|
25
|
+
# Rebuild extension Typescript source after making changes
|
|
26
|
+
# IMPORTANT: Unlike the steps above which are performed only once, do this step
|
|
27
|
+
# every time you make a change.
|
|
28
|
+
jlpm build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Watch the source directory in one terminal, automatically rebuilding when needed
|
|
35
|
+
jlpm watch
|
|
36
|
+
# Run JupyterLab in another terminal
|
|
37
|
+
jupyter lab
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
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).
|
|
41
|
+
|
|
42
|
+
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jupyter lab build --minimize=False
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Development uninstall
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip uninstall jupyterlab_vim_langmap
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
In development mode, you will also need to remove the symlink created by `jupyter-builder develop`
|
|
55
|
+
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
|
|
56
|
+
folder is located. Then you can remove the symlink named `jupyterlab-vim-langmap` within that folder.
|
|
57
|
+
|
|
58
|
+
## Packaging the extension
|
|
59
|
+
|
|
60
|
+
See [RELEASE](RELEASE.md)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, yvvakimoto
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: jupyterlab_vim_langmap
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Remap vim command-mode keys back to QWERTY positions when the OS emulates Dvorak
|
|
5
|
+
Project-URL: Homepage, https://github.com/yvvakimoto/jupyterlab-vim-langmap
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/yvvakimoto/jupyterlab-vim-langmap/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/yvvakimoto/jupyterlab-vim-langmap.git
|
|
8
|
+
Author-email: yvvakimoto <yvvakimoto@ymail.ne.jp>
|
|
9
|
+
License-Expression: BSD-3-Clause
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: codemirror,dvorak,jupyter,jupyterlab,jupyterlab-extension,keyboard-layout,langmap,vim
|
|
12
|
+
Classifier: Framework :: Jupyter
|
|
13
|
+
Classifier: Framework :: Jupyter :: JupyterLab
|
|
14
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: 4
|
|
15
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
|
|
16
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: jupyterlab-vim>=4.1
|
|
26
|
+
Requires-Dist: jupyterlab<5,>=4.2
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: jupyter-builder>=1.2.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: jupyterlab>=4; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# jupyterlab-vim-langmap
|
|
33
|
+
|
|
34
|
+
Put vim's command keys back on their QWERTY physical positions, without touching what you type.
|
|
35
|
+
|
|
36
|
+
If you emulate Dvorak (or any other layout) at the OS level — Yamabuki R, PowerToys, `setxkbmap`, a programmable keyboard — then [jupyterlab-vim](https://github.com/jupyterlab-contrib/jupyterlab-vim) sees the remapped characters, so `hjkl` lands wherever Dvorak puts those letters rather than under your fingers. Vim solves this with `langmap` and VSCodeVim exposes it as `vim.langmap`, but jupyterlab-vim has no equivalent setting.
|
|
37
|
+
|
|
38
|
+
This extension takes one langmap string and applies it to both layers of JupyterLab that read the keyboard.
|
|
39
|
+
|
|
40
|
+
## What it changes
|
|
41
|
+
|
|
42
|
+
| Layer | Keys | Mechanism |
|
|
43
|
+
| ---------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
44
|
+
| vim | Normal, Visual and operator-pending, inside cell and file editors | `Vim.langmap()`, built into `@replit/codemirror-vim` |
|
|
45
|
+
| JupyterLab | Jupyter Command mode (`dd`, `x`, `c`, `v`, `a`, `b`, `z`), the command palette, menu mnemonics | swaps the `@lumino/keyboard` layout, which resolves every binding |
|
|
46
|
+
|
|
47
|
+
## What it leaves alone
|
|
48
|
+
|
|
49
|
+
- **Text you type in Insert mode.** The langmap only feeds command matching; the character itself is still inserted by the browser from the original key event.
|
|
50
|
+
- **The Ex and search prompts.** `:w` and `/pattern` are typed in your actual layout, matching vim's own behaviour.
|
|
51
|
+
- **Character arguments** of `f`, `t`, `r`, `m`, registers and marks. The vim layer suppresses translation for the key right after those commands, so `fx` searches for a real `x`.
|
|
52
|
+
|
|
53
|
+
Counts, operators and operator-pending motions all work, because the langmap is applied when the key event is turned into a key name — before any command matching happens.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install jupyterlab-vim-langmap
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
jupyterlab-vim comes along as a dependency. Reload the browser tab afterwards.
|
|
62
|
+
|
|
63
|
+
## Settings
|
|
64
|
+
|
|
65
|
+
Settings → Advanced Settings Editor → **Vim langmap**.
|
|
66
|
+
|
|
67
|
+
| Setting | Default | Meaning |
|
|
68
|
+
| ------------------------- | ---------- | ----------------------------------------------------------------------------- |
|
|
69
|
+
| `enabled` | `true` | Master switch. Turning it off restores both layers to their defaults. |
|
|
70
|
+
| `preset` | `"dvorak"` | The built-in Dvorak → QWERTY mapping, or `"custom"` to use `langmap` below. |
|
|
71
|
+
| `langmap` | `""` | Any vim `langmap` string. Only read when `preset` is `"custom"`. |
|
|
72
|
+
| `remapCtrl` | `true` | Also remap Ctrl/Alt/Meta combinations, so `Ctrl-d` stays on the physical `d`. |
|
|
73
|
+
| `applyToVim` | `true` | The vim half. |
|
|
74
|
+
| `applyToJupyterShortcuts` | `true` | The JupyterLab half. |
|
|
75
|
+
|
|
76
|
+
The `langmap` format is the one from vim's `:set langmap=` and VSCodeVim's `vim.langmap`: comma-separated parts, each either a run of from/to character pairs (`aAbB`) or `fromlist;tolist` (`abc;ABC`). Escape a literal comma or semicolon with a backslash.
|
|
77
|
+
|
|
78
|
+
### The built-in preset vs. VSCodeVim's `vim.langmap`
|
|
79
|
+
|
|
80
|
+
The `dvorak` preset is the Dvorak string that circulates for VSCodeVim **plus the two pairs it omits**, `{_` and `}+`.
|
|
81
|
+
|
|
82
|
+
Without them the physical `-` and `=` keys still emit `{` and `}` when shifted, which vim reads as the paragraph motions. So those motions fire from two different physical keys while `_` and `+` are unreachable where QWERTY puts them. If you would rather match your VSCode configuration exactly, set `preset` to `"custom"` and paste the original string into `langmap`.
|
|
83
|
+
|
|
84
|
+
### When to turn `applyToJupyterShortcuts` off
|
|
85
|
+
|
|
86
|
+
JupyterLab's own keybindings are resolved from `event.keyCode`. Some OS-level remappers rewrite the virtual key code, others leave it on the physical key — and in the second case JupyterLab's shortcuts are already in QWERTY positions, so remapping them again would move them off.
|
|
87
|
+
|
|
88
|
+
To find out which kind you have, download [`tools/keylog.html`](https://github.com/yvvakimoto/jupyterlab-vim-langmap/blob/main/tools/keylog.html) and open it in a browser. With your remapper on, press a few letter keys and then the same keys with Ctrl held: it reports `event.key`, `event.code` and `event.keyCode` for each, and tells you which settings you need. (The file ships in the repository, not in the wheel.)
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install -e ".[dev]"
|
|
94
|
+
jupyter labextension develop --overwrite .
|
|
95
|
+
jlpm watch
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then run `jupyter lab` in another terminal.
|
|
99
|
+
|
|
100
|
+
To check the pure logic — the langmap parser, and that the keycode remap is a permutation of the main key block so no shortcut becomes unreachable:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx tsc --module commonjs --target ES2018 --rootDir . --outDir .check-build src/langmap.ts src/keycodes.ts
|
|
104
|
+
node tools/check-langmap.cjs .check-build/src
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Design notes
|
|
108
|
+
|
|
109
|
+
The vim `langmap` lives in module-level state inside `@replit/codemirror-vim`, so this extension has to touch the **same module instance** jupyterlab-vim uses. `package.json` declares
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
"sharedPackages": { "@replit/codemirror-vim": { "bundled": false } }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
which tells webpack to consume the copy jupyterlab-vim contributes to the module federation share scope rather than bundling one. The consequence is that a future jupyterlab-vim which moves outside `^6.2.1` would leave the vim half inactive — it logs a warning to the console when that happens.
|
|
116
|
+
|
|
117
|
+
The langmap sits in a different layer from key mappings (`Vim.map` / `Vim.mapclear`), so jupyterlab-vim's `mapclear` at startup does not wipe it and plugin activation order does not matter.
|
|
118
|
+
|
|
119
|
+
On the JupyterLab side, `@lumino/keyboard` resolves every keybinding through a single `keyCode → key name` table, so one permuted table covers Command mode, the palette and menu mnemonics at once — no per-shortcut overrides. Only the unshifted half of a langmap is used there, because `event.keyCode` carries no shift state.
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
BSD-3-Clause
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# jupyterlab-vim-langmap
|
|
2
|
+
|
|
3
|
+
Put vim's command keys back on their QWERTY physical positions, without touching what you type.
|
|
4
|
+
|
|
5
|
+
If you emulate Dvorak (or any other layout) at the OS level — Yamabuki R, PowerToys, `setxkbmap`, a programmable keyboard — then [jupyterlab-vim](https://github.com/jupyterlab-contrib/jupyterlab-vim) sees the remapped characters, so `hjkl` lands wherever Dvorak puts those letters rather than under your fingers. Vim solves this with `langmap` and VSCodeVim exposes it as `vim.langmap`, but jupyterlab-vim has no equivalent setting.
|
|
6
|
+
|
|
7
|
+
This extension takes one langmap string and applies it to both layers of JupyterLab that read the keyboard.
|
|
8
|
+
|
|
9
|
+
## What it changes
|
|
10
|
+
|
|
11
|
+
| Layer | Keys | Mechanism |
|
|
12
|
+
| ---------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
13
|
+
| vim | Normal, Visual and operator-pending, inside cell and file editors | `Vim.langmap()`, built into `@replit/codemirror-vim` |
|
|
14
|
+
| JupyterLab | Jupyter Command mode (`dd`, `x`, `c`, `v`, `a`, `b`, `z`), the command palette, menu mnemonics | swaps the `@lumino/keyboard` layout, which resolves every binding |
|
|
15
|
+
|
|
16
|
+
## What it leaves alone
|
|
17
|
+
|
|
18
|
+
- **Text you type in Insert mode.** The langmap only feeds command matching; the character itself is still inserted by the browser from the original key event.
|
|
19
|
+
- **The Ex and search prompts.** `:w` and `/pattern` are typed in your actual layout, matching vim's own behaviour.
|
|
20
|
+
- **Character arguments** of `f`, `t`, `r`, `m`, registers and marks. The vim layer suppresses translation for the key right after those commands, so `fx` searches for a real `x`.
|
|
21
|
+
|
|
22
|
+
Counts, operators and operator-pending motions all work, because the langmap is applied when the key event is turned into a key name — before any command matching happens.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install jupyterlab-vim-langmap
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
jupyterlab-vim comes along as a dependency. Reload the browser tab afterwards.
|
|
31
|
+
|
|
32
|
+
## Settings
|
|
33
|
+
|
|
34
|
+
Settings → Advanced Settings Editor → **Vim langmap**.
|
|
35
|
+
|
|
36
|
+
| Setting | Default | Meaning |
|
|
37
|
+
| ------------------------- | ---------- | ----------------------------------------------------------------------------- |
|
|
38
|
+
| `enabled` | `true` | Master switch. Turning it off restores both layers to their defaults. |
|
|
39
|
+
| `preset` | `"dvorak"` | The built-in Dvorak → QWERTY mapping, or `"custom"` to use `langmap` below. |
|
|
40
|
+
| `langmap` | `""` | Any vim `langmap` string. Only read when `preset` is `"custom"`. |
|
|
41
|
+
| `remapCtrl` | `true` | Also remap Ctrl/Alt/Meta combinations, so `Ctrl-d` stays on the physical `d`. |
|
|
42
|
+
| `applyToVim` | `true` | The vim half. |
|
|
43
|
+
| `applyToJupyterShortcuts` | `true` | The JupyterLab half. |
|
|
44
|
+
|
|
45
|
+
The `langmap` format is the one from vim's `:set langmap=` and VSCodeVim's `vim.langmap`: comma-separated parts, each either a run of from/to character pairs (`aAbB`) or `fromlist;tolist` (`abc;ABC`). Escape a literal comma or semicolon with a backslash.
|
|
46
|
+
|
|
47
|
+
### The built-in preset vs. VSCodeVim's `vim.langmap`
|
|
48
|
+
|
|
49
|
+
The `dvorak` preset is the Dvorak string that circulates for VSCodeVim **plus the two pairs it omits**, `{_` and `}+`.
|
|
50
|
+
|
|
51
|
+
Without them the physical `-` and `=` keys still emit `{` and `}` when shifted, which vim reads as the paragraph motions. So those motions fire from two different physical keys while `_` and `+` are unreachable where QWERTY puts them. If you would rather match your VSCode configuration exactly, set `preset` to `"custom"` and paste the original string into `langmap`.
|
|
52
|
+
|
|
53
|
+
### When to turn `applyToJupyterShortcuts` off
|
|
54
|
+
|
|
55
|
+
JupyterLab's own keybindings are resolved from `event.keyCode`. Some OS-level remappers rewrite the virtual key code, others leave it on the physical key — and in the second case JupyterLab's shortcuts are already in QWERTY positions, so remapping them again would move them off.
|
|
56
|
+
|
|
57
|
+
To find out which kind you have, download [`tools/keylog.html`](https://github.com/yvvakimoto/jupyterlab-vim-langmap/blob/main/tools/keylog.html) and open it in a browser. With your remapper on, press a few letter keys and then the same keys with Ctrl held: it reports `event.key`, `event.code` and `event.keyCode` for each, and tells you which settings you need. (The file ships in the repository, not in the wheel.)
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install -e ".[dev]"
|
|
63
|
+
jupyter labextension develop --overwrite .
|
|
64
|
+
jlpm watch
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Then run `jupyter lab` in another terminal.
|
|
68
|
+
|
|
69
|
+
To check the pure logic — the langmap parser, and that the keycode remap is a permutation of the main key block so no shortcut becomes unreachable:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx tsc --module commonjs --target ES2018 --rootDir . --outDir .check-build src/langmap.ts src/keycodes.ts
|
|
73
|
+
node tools/check-langmap.cjs .check-build/src
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Design notes
|
|
77
|
+
|
|
78
|
+
The vim `langmap` lives in module-level state inside `@replit/codemirror-vim`, so this extension has to touch the **same module instance** jupyterlab-vim uses. `package.json` declares
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
"sharedPackages": { "@replit/codemirror-vim": { "bundled": false } }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
which tells webpack to consume the copy jupyterlab-vim contributes to the module federation share scope rather than bundling one. The consequence is that a future jupyterlab-vim which moves outside `^6.2.1` would leave the vim half inactive — it logs a warning to the console when that happens.
|
|
85
|
+
|
|
86
|
+
The langmap sits in a different layer from key mappings (`Vim.map` / `Vim.mapclear`), so jupyterlab-vim's `mapclear` at startup does not wipe it and plugin activation order does not matter.
|
|
87
|
+
|
|
88
|
+
On the JupyterLab side, `@lumino/keyboard` resolves every keybinding through a single `keyCode → key name` table, so one permuted table covers Command mode, the palette and menu mnemonics at once — no per-shortcut overrides. Only the unshifted half of a langmap is used there, because `event.keyCode` carries no shift state.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
BSD-3-Clause
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Making a new release of jupyterlab_vim_langmap
|
|
2
|
+
|
|
3
|
+
The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).
|
|
4
|
+
|
|
5
|
+
## Manual release
|
|
6
|
+
|
|
7
|
+
### Python package
|
|
8
|
+
|
|
9
|
+
This extension can be distributed as Python packages. All of the Python
|
|
10
|
+
packaging instructions are in the `pyproject.toml` file to wrap your extension in a
|
|
11
|
+
Python package. Before generating a package, you first need to install some tools:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install build twine hatch
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Bump the version using `hatch`. By default this will create a tag.
|
|
18
|
+
See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
hatch version <new-version>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Make sure to clean up all the development files before building the package:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
jlpm clean:all
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
You could also clean up the local git repository:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clean -dfX
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
|
|
43
|
+
|
|
44
|
+
Then to upload the package to PyPI, do:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
twine upload dist/*
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### NPM package
|
|
51
|
+
|
|
52
|
+
To publish the frontend part of the extension as a NPM package, do:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm login
|
|
56
|
+
npm publish --access public
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Automated releases with the Jupyter Releaser
|
|
60
|
+
|
|
61
|
+
The extension repository should already be compatible with the Jupyter Releaser. But
|
|
62
|
+
the GitHub repository and the package managers need to be properly set up. Please
|
|
63
|
+
follow the instructions of the Jupyter Releaser [checklist](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo_from_repo.html).
|
|
64
|
+
|
|
65
|
+
For the release workflows in this repository, make sure GitHub is configured with:
|
|
66
|
+
|
|
67
|
+
- a `release` environment
|
|
68
|
+
- an `APP_PRIVATE_KEY` secret
|
|
69
|
+
- an `APP_ID` repository variable
|
|
70
|
+
|
|
71
|
+
When using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers), `NPM_TOKEN` is not required (and trusted publishing is recommended). Configure `NPM_TOKEN` only if you are publishing without trusted publishers.
|
|
72
|
+
|
|
73
|
+
Here is a summary of the steps to cut a new release:
|
|
74
|
+
|
|
75
|
+
- Go to the Actions panel
|
|
76
|
+
- Run the "Step 1: Prep Release" workflow
|
|
77
|
+
- Check the draft changelog
|
|
78
|
+
- Run the "Step 2: Publish Release" workflow
|
|
79
|
+
|
|
80
|
+
> [!NOTE]
|
|
81
|
+
> Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html)
|
|
82
|
+
> for more information.
|
|
83
|
+
|
|
84
|
+
## Publishing to `conda-forge`
|
|
85
|
+
|
|
86
|
+
If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html
|
|
87
|
+
|
|
88
|
+
Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
5
|
+
import globals from 'globals';
|
|
6
|
+
import jupyterPlugin from '@jupyter/eslint-plugin';
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
{
|
|
10
|
+
ignores: [
|
|
11
|
+
'node_modules',
|
|
12
|
+
'dist',
|
|
13
|
+
'coverage',
|
|
14
|
+
'**/*.js',
|
|
15
|
+
'**/*.d.ts',
|
|
16
|
+
'.venv'
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
js.configs.recommended,
|
|
20
|
+
tseslint.configs.recommended,
|
|
21
|
+
{
|
|
22
|
+
plugins: {
|
|
23
|
+
jupyter: jupyterPlugin
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
jupyterPlugin.configs.recommended,
|
|
27
|
+
{
|
|
28
|
+
// Development helper scripts under tools/ are plain CommonJS run by node.
|
|
29
|
+
files: ['**/*.cjs'],
|
|
30
|
+
languageOptions: {
|
|
31
|
+
globals: {
|
|
32
|
+
...globals.node
|
|
33
|
+
},
|
|
34
|
+
sourceType: 'commonjs'
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
'@typescript-eslint/no-require-imports': 'off'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
42
|
+
languageOptions: {
|
|
43
|
+
globals: {
|
|
44
|
+
...globals.browser,
|
|
45
|
+
...globals.es2015,
|
|
46
|
+
...globals.node
|
|
47
|
+
},
|
|
48
|
+
parserOptions: {
|
|
49
|
+
project: 'tsconfig.json',
|
|
50
|
+
sourceType: 'module'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
'@typescript-eslint/naming-convention': [
|
|
55
|
+
'error',
|
|
56
|
+
{
|
|
57
|
+
selector: 'interface',
|
|
58
|
+
format: ['PascalCase'],
|
|
59
|
+
custom: {
|
|
60
|
+
regex: '^I[A-Z]',
|
|
61
|
+
match: true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
|
|
66
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
67
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
68
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
69
|
+
'@typescript-eslint/quotes': [
|
|
70
|
+
'error',
|
|
71
|
+
'single',
|
|
72
|
+
{ avoidEscape: true, allowTemplateLiterals: false }
|
|
73
|
+
],
|
|
74
|
+
curly: ['error', 'all'],
|
|
75
|
+
eqeqeq: 'error',
|
|
76
|
+
'prefer-arrow-callback': 'error'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
prettierRecommended
|
|
80
|
+
]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from ._version import __version__
|
|
3
|
+
except ImportError:
|
|
4
|
+
# Fallback when using the package in dev mode without installing
|
|
5
|
+
# in editable mode with pip. It is highly recommended to install
|
|
6
|
+
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
|
|
7
|
+
import warnings
|
|
8
|
+
warnings.warn("Importing 'jupyterlab_vim_langmap' outside a proper installation.")
|
|
9
|
+
__version__ = "dev"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _jupyter_labextension_paths():
|
|
13
|
+
return [{
|
|
14
|
+
"src": "labextension",
|
|
15
|
+
"dest": "jupyterlab-vim-langmap"
|
|
16
|
+
}]
|