VSCodeVim / VSCodeVim/Vim

VSCodeVim Visual Mode Mapping Error: E486 Pattern Not Found When Yanking and Searching

Open
#9,857 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 using VSCodeVim, a standard Vim visual-mode mapping for // that yanks the selection and searches for it fails with E486: Pattern not found: \Vescape(@",'/').
The same mapping works correctly in regular Vim on Linux. In VSCodeVim, it appears that the expression register part of the mapping (=escape(@",'/')) is not being evaluated, and is instead treated as literal text in the search pattern.
Minimal mapping:
vnoremap // y/\V=escape(@",'/')

To Reproduce
Steps to reproduce the behavior:

  1. Open any text file in VSCode with VSCodeVim enabled.
  2. Add the following to your VSCodeVim configuration (e.g. vimrc used by the extension): vnoremap // y/\V=escape(@",'/')
  3. Visually select some text (e.g. v or V, then move the cursor).Press //
  4. Observe that instead of searching for the selected text, an error is shown:
    E486: Pattern not found: \Vescape(@",'/')

Expected behavior
Execute the search and move the cursor to the next occurrence of the selected text.
In other words, behavior should match regular Vim on Linux, where this mapping works as intended.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.32.2
  • VSCode version: Cursor 2.1.50
  • OS: Windows 11

Additional context
Add any other context about the problem here.

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

Start by reproducing the visual-mode mapping in VSCodeVim with the configuration shown, then inspect the remapping debug logs linked in the issue. Trace how the =... expression register is handled during visual-mode mappings. Done means the mapping searches for the selected text without producing E486, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.