Keybinding for substitute failing
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
When mapping a keybinding to perform a common substitute command the result fails to submit the command.
To Reproduce
Steps to reproduce the behavior:
- Add the following code to your
settings.jsonfile:
"vim.normalModeKeyBindings": [
{
"before": ["<leader>", "k"],
"commands": [":s/a/A/"]
}
]
- Create a file with some lowercase "a"s:
echo "The cat in the hat." > substitute-test.txt - Open substitute-test.txt, navigate to line 1, and use the new keybinding: <"\">, <"k">.
- Notice ":s/a/A/" is displayed on the command bar (see image), but not submitted, and you are now in normal mode.
- Try switching to command mode with ":", and notice the substitute command is overwritten.
Expected behavior
"The cat in the hat." is modified to "The cAt in the hat."
Screenshots


Environment (please complete the following information):
- Extension (VsCodeVim) version: v1.24.3
- VSCode version: 1.74.3
- OS: MacOS 12.6.2
Additional context
A StackExchange post I made: https://stackoverflow.com/questions/75088265/vscodevim-extension-substitute-keybindings
Note the following code does result in the expected behavior of moving to the first line:
"vim.normalModeKeyBindings": [
{
"before": ["<leader>", "g"],
"commands": [":1"]
}
]
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 the settings.json mapping and substitute-test.txt example, then trace how the keybinding command is submitted after :s/a/A/ is displayed. Done means the mapping submits the substitute command and changes "The cat in the hat." to "The cAt in the hat.".
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
- 48/100