Skip to content

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

@got-to-move-on

Description

@got-to-move-on

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions