VSCodeVim / VSCodeVim/Vim

Keybinding for substitute failing

Open
#8,218 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

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:

  1. Add the following code to your settings.json file:
"vim.normalModeKeyBindings": [
    {
      "before": ["<leader>", "k"],
      "commands": [":s/a/A/"]
    }
]
  1. Create a file with some lowercase "a"s: echo "The cat in the hat." > substitute-test.txt
  2. Open substitute-test.txt, navigate to line 1, and use the new keybinding: <"\">, <"k">.
  3. Notice ":s/a/A/" is displayed on the command bar (see image), but not submitted, and you are now in normal mode.
  4. 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
image

image

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.