Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Highlight Anything When Cursor is Not on Word #18

Open
xanderdunn opened this issue Jan 4, 2015 · 2 comments
Open

Don't Highlight Anything When Cursor is Not on Word #18

xanderdunn opened this issue Jan 4, 2015 · 2 comments

Comments

@xanderdunn
Copy link

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!

@qstrahl
Copy link
Owner

qstrahl commented Jan 4, 2015

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
#18.

@matt1003
Copy link

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants