VSCodeVim / VSCodeVim/Vim

Map Vim Keyboard Shortcut to VS Code Command (e.g. map 'leader'+'key' to any given VS Code shortcut)

Open
#7,616 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Does this issue occur when all extensions are disabled?: Yes

VS Code Version: 1.66.0
OS Version: Monterey 12.2.1
Bug:
Currently, VS Code does not enable you to map a Vim keymap to a Jupyter extension command. (specifically, execSelectionInteractive).

Steps to Reproduce:

Install VS Code vim extension
Add the below to settings.json
"vim.leader": "",
"vim.normalModeKeyBindings": [
{
"before": [
"",
"e"
],
"after": [],
"commands": [
{
"command": "jupyter.execSelectionInteractive",
"when": "editorTextFocus",
"args": []
}
]
}
],
"vim.visualModeKeyBindings": [
{
"before": [
"",
"e"
],
"after": [],
"commands": [
{
"command": "jupyter.execSelectionInteractive",
"when": "editorTextFocus",
"args": []
}
]
}]
Notice that pressing the ["","e"] combination does not send the code to be executed in the interactive terminal.
Notes to the above big:

Changing the "before" keymap, doesn't make a difference. (i.e. it's not down to an issue with the 'leader' mapping).
Changing the "command" to read 'python.execSelectionInTerminal' DOES work. (so, the issue is with the JUPYTER extension command, and NOT other VSCode commands).
Changing the keymap for "jupyter.execSelectionInteractive" from the usual "shift+enter" in the "Keyboard Shortcuts" page of VSCode to something like "cmd+enter" (or anything), also DOES work. So, it IS possible to remap a keyboard shortcut for the command from the VS Code Keyboard Shortcuts settings.
Thus, we've isolated that the problem only arises when you try and do a VIM extension keymap (i.e. from the Settings.JSON page), to map to a Jupyter extension command.
Fix:
It would be great if you extended support such that users could map any of their vim keymaps to any commands currently mappable in the "Keyboard Shortcuts" section. This would have a positive impact on all users who already have a very comfortable Vim / eMacs set-up, and would like to move to VSCode (for all the added functionality), but are confronted with the very large barrier to entry as it's quite hard to port your already ingrained muscle memory over...

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the settings.json Vim normal- and visual-mode mappings for jupyter.execSelectionInteractive, comparing them with python.execSelectionInTerminal and a Keyboard Shortcuts mapping. Trace the keybinding and command-dispatch entry points to find why the Jupyter command is not invoked; done means the Vim mapping executes the selected code in the interactive terminal.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.