Skip to content

Problem with highlighting after running custom substitution mapping #21

@mroavi

Description

@mroavi

Hi @pgdouyon. I'm running into a strange problem. I have a mapping that I use very often to substitute instances of a given word on a selected range of lines, with another word:

vnoremap <Leader>su :s//<C-r>=substitute(@/,'\\<\\|\\>\\|\\V','','g')<CR>/g<left><left>

The problem is that after using this mapping, evanescu stops highlighting properly. Here is a demo:

evanesco-bug_Peek 2021-09-22 17-06

Here is a summary of the commands I'm running:

  1. Type * to save the word under the cursor in the search register
  2. Go to visual line mode to select which lines should be affected by the substitution command.
  3. Invoke the mapping above to substitute the string in the search register with a string that starts with the same characters (e.g evanescu with even).
  4. Type * on a different word. Note that not all instances are highlighted properly.

Do know what could be going wrong?

Edit: apparently, after running the substitution mapping above, evanescu only highlights words in the range of lines that were previously selected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions