VSCodeVim / VSCodeVim/Vim

Same key for 2 different keybinds

Open
#8,430 0 comments 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

Hello!

This is not a bug, but just a question..

I want to know if it's possible to keybind the same key to two different actions using the 'when' arg based on the filetype. I've tried to do that, but the second one kinda ovewrites the first one.

I have the following keybinds:

{
"before": ["key"],
"commands": [{command_1},{command_2},{etc}],
"when":"resourceExtname == .ext1"
},
{
"before": ["key"],
"commands": [{command_3},{command_4},{etc}],
"when":"resourceExtname == .ext2"
}

However, when i do that, the first keybind gets overwritten by the second. Is there any way to achieve this?

Thanks in advance.

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

Review VS Code's keybinding resolution and when clause behavior, then trace how VSCodeVim handles keybindings. Confirm whether filetype-specific duplicate bindings can coexist and document the supported configuration or the limits found. The issue names no repository files or tests, so the relevant entry point must first be located.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
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.