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.16k stars 47 forks source link

Don't override the highlight of hexokinase #46

Closed kevinhwang91 closed 4 years ago

kevinhwang91 commented 4 years ago

No matter the priority of highlight what I set, illuminate always override the highlight of hexokinase. image

Maybe add a blacklist for some specified pattern?

RRethy commented 4 years ago

Unfortunately this cannot be changed based on the highlight priority since hexokinase uses nvim_buf_add_highlight to place highlights on the buffer which does not utilize the priority mechanism that is used with matchadd and matchaddpos. In terms of a black list, this also would not work because illuminate does not place highlights down manually, it does so using matchadd which matches a single pattern so any blacklist would have to be combined with the main pattern with backreferences (and even then I'm not sure if it would work).

That being said, to fix the example in your screenshot, you can use let g:Illuminate_highlightUnderCursor = 0.

kevinhwang91 commented 4 years ago

I used https://github.com/neoclide/coc-highlight before, which contains the feature of illuminate and hexokinase, also use rpc to call nvim_buf_add_highlight to highlight, but it can handle the override color.

I think illuminate and hexokinase are written by the same author, they should get along with each other.

RRethy commented 4 years ago

They do get along with each other. If you want illuminate to not override hexokinase, then don't use the same highlighting for both, it's that simple. You cannot use background highlighting for hexokinase and background highlighting for illuminate and expect one plugin to disable randomly.

I (and many others) use both plugins and they get along fine, for me illuminate highlights the background while hexokinase highlights the foreground.

I think if coc-highlight does both illuminate and hexokinase, then you should just use it since it's clearly more suited to your needs.