Repeat doesn't work for user-defined keybindings
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
In normal mode, Vim (the actual editor) allows you to use <number><normal mode command> to repeat normal mode command, even a re-bound command, number times. However, in VSCode, if the command is a user-defined keybinding, then it doesn't get repeated; it just runs once, and the number prefix is ignored.
To Reproduce
In VSCode preferences, define a vim.normalModeKeyBindingsNonRecursive keybinding. E.g,
{
"before": ["y", "y"],
"after": ["Y"]
}
(which I use to make yy behave the same as dd and cc, i.e., to operate on the whole line).
Once this is defined, <number>yy does not yank number lines; it only calls yy once, which just yanks the current line. E.g., 5yy yanks a single line instead of five lines.
Expected behavior
After defining this keyboard shortcut, 5yy should function as 5Y would have without the binding defined, which would yank the current line plus the next four (five lines total).
- Extension (VsCodeVim) version: 0.16.0
- VSCode version: 1.25.1
- OS: macOS Mojave
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with a user-defined normalModeKeyBindingsNonRecursive mapping such as yy to Y, then trace the normal-mode repeat handling and keybinding dispatch. Done means a numeric prefix such as 5yy repeats the mapped command for five lines, matching 5Y.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100