VSCodeVim / VSCodeVim/Vim

How to use count prefix in custom keybindings?

Open
#2,933 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This might end up being a feature request but atm I just don't know if I'm missing something.

I made the following keybinding for commenting a line:

    "vim.normalModeKeyBindings": [
        {
            "before": ["<leader>", "c", "l"],
            "commands": ["editor.action.commentLine"]
        }
    ]

It works for a single line, and I expected eg 3 <leader> c l to comment 3 lines but instead nothing happens. Do I need to capture the count prefix in the keybinding definition? or something else?

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

Reproduce the custom keybinding from the issue in VSCodeVim, comparing a single-line invocation with 3 <leader> c l. Start by tracing how vim.normalModeKeyBindings handles count prefixes; done means determining whether counts are supported for custom commands and documenting or implementing the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.