vim-matchmaker icon indicating copy to clipboard operation
vim-matchmaker copied to clipboard

Don't Highlight Anything When Cursor is Not on Word

Open xanderdunn opened this issue 11 years ago • 2 comments

You can see in the below screenshot that although my cursor is not actually on any word at all, Matchmaker is highlighting (underlining) the word closest to the cursor.

screen shot 2015-01-03 at 18 36 56

It's very strange that anything should be highlighted when I'm not focusing on anything. I find it much more of a distraction than it is helpful. Could we highlight words only when the cursor is truly on top of them? Or perhaps at least make this an option?

Thanks!

xanderdunn avatar Jan 04 '15 02:01 xanderdunn

I agree. The reason for this is we just use expand('<cword>') which is interpreted as the word closest to the cursor. I could put in a check of some kind to assert that the character under the cursor is a keyword character.

On Sat, 3 Jan 2015 21:42 Alex Dunn [email protected] wrote:

You can see in the below screenshot that although my cursor is not actually on any word at all, Matchmaker is highlighting (underlining) the word closest to the cursor.

[image: screen shot 2015-01-03 at 18 36 56] https://cloud.githubusercontent.com/assets/1313618/5604542/dee9ccd8-9377-11e4-956a-aff1e6c48017.png

It's very strange that anything should be highlighted when I'm not focusing on anything. I find it much more of a distraction than it is helpful. Could we highlight words only when the cursor is truly on top of them? Or perhaps at least make this an option?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/qstrahl/vim-matchmaker/issues/18.

qstrahl avatar Jan 04 '15 03:01 qstrahl

There is a potential solution described on stack overflow: http://stackoverflow.com/questions/15020143/vim-script-check-if-the-cursor-is-on-the-current-word

let cInd = strridx(getline('.'), expand(""), col('.') - 1)
let isOnKeyword = (cInd >= 0 && (cInd + strlen(expand(""))) >= (col('.') - 1))

matt1003 avatar Sep 16 '16 04:09 matt1003