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

ignore when word under cursor is blank #22

Closed iberianpig closed 6 years ago

iberianpig commented 6 years ago

Hi, @RRethy

I found a problem with editing the content including Japanese.

Some Japanese word is hightlighted when no charactor is under the cursor. problem

So, I fixed not to highlight when it was blank. fixed

RRethy commented 6 years ago

Very interesting bug. I did some testing myself to understand what is going on. Using the following in an empty buffer:

わきでkj
aaaaaaaaaaaaaa

Then I ran /\< and /\>. It seems that Vim matched k on line 1 with both searches which means k is both the start and the end of a word. This is very weird behaviour I can only reproduce with non-ascii characters which leads me to believe it has to do with 'iskeyword'. But I'm not sure tbh. I'll merge this in for now since it is a fix that works. If you or anyone else reading this has an explanation I would love to hear it.