VSCodeVim / VSCodeVim/Vim

Is "<leader> key" supposed to be able to call keybindings in keybindings.json?

Open
#5,653 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

Everything is up to date

I have a handy keybinding that opens the file explorer and closes it if its active (its a hack because there's no toggleExporer command built in). I had to put this in keybindings.json because of the conditional ("when")

keybindings.json

  {
    "key": "ctrl+'",
    "command": "workbench.view.explorer"
  },
  {
    "key": "ctrl+'",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "activeViewlet == 'workbench.view.explorer'"
  }

I'm having no luck being able to call it using a leader key

    {
      "before": ["leader", "d"],
      "after": ["C-'"]
    },

However I have no problems with using the leader key with remapping vim keys and calling vscode actions:

    {
      "before": ["leader", "d"],
      "after": ["C-f"]
    },
    {
      "before": ["leader", "s"],
      "commands": ["workbench.action.files.save"]
    },

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 with the keybindings.json examples and compare the leader mapping that triggers C-' with the mappings that trigger C-f or a VS Code command. Trace how leader mappings dispatch keybindings and define done as making the conditional explorer bindings callable through the leader key, with coverage for the reported mapping behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.