RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.12k stars 44 forks source link

[Feature Request]: visual mode highlights selection matches #176

Closed mcauley-penney closed 9 months ago

mcauley-penney commented 10 months ago

Configuration

require('illuminate').configure({
    delay = 150,
    providers = { 'regex' },
    under_cursor = false,
}) 

I only use the regex provider.

Description

In visual mode, vim-illuminate continues to highlight the word under the cursor. This doesn't make a lot of sense for visual mode, when the user may want to see partial word matches, e.g. where a prefix exists in a string that vim considers an entire word ("xxxyyy" where you want to find all instances of "xxx", for a contrived example). I've read #81 and #141 and, rather than disable the functionality in visual mode, I'd like it to be improved.

visual-match-illuminate

Value statement

This feature is a nicety that people who work with data, such as csv, text files, and JSON, may appreciate. I have often wanted this when I wanted to check if a long, human-unreadable string which contained multiple words had matches with other long and unreadable strings in the visible parts of a file.

Precedent

I do not and have never used VSCode other than experimentation, but it allows for highlighting all visually selected matches (see GIF). One Neovim plugin that I know of, aaron-p1/match-visual.nvim, provides similar functionality but, there is no way to turn off vim-illuminate in visual mode, so they conflict. Also, that plugin is fairly new, not popular as of now, and always highlights the match under cursor, effectively overriding the Visual highlight (vim-illuminate allows us to stop this with under_cursor = false, which I have in my config).

visual-match-vscode

RRethy commented 9 months ago

I'm not clear on what you are looking for. For your example, are you saying if you highlight the prefix xxx in the text xxxyyy, you want all other instances of xxx to be highlighted?

mcauley-penney commented 9 months ago

Yes. Whatever highlighted in visual mode should be highlighted elsewhere in the buffer, with a means to set how many characters must be highlighted before it starts I think.

RRethy commented 9 months ago

That's out of scope for this plugin.