unblevable / quick-scope

Lightning fast left-right movement in Vim
MIT License
1.42k stars 54 forks source link

First occurrence of char is not highlighted #92

Closed mark2185 closed 1 year ago

mark2185 commented 1 year ago

Noticed it happening on this:

let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']

I put the cursor on e.g. the first h in highlight and trigger the quick-scope highlight and there are multiple ts, the first one being in the same word, but only the second one gets highlighted.

image

It's reproducible with this minimal vimrc:

let &rtp.=',/home/mark/.vim/plugged/quick-scope'
syntax on

" highlight unique chars when pressing {fFtT}
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']

I tried different colorschemes, nothing changes, so I'm guessing it really doesn't change, not that it's just not visible.

$> vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Aug 11 2022 22:41:12)
Included patches: 1-193
bradford-smith94 commented 1 year ago

Sorry for not getting around to this.

I believe this is due to a design choice of quick-scope. If I remember correctly the highlighting identifies characters to jump to to quickly get to other words in the line (and so it skips over targets in the current word).

mark2185 commented 1 year ago

Sorry for not getting around to this.

No worries, there are more important things than github issues :)

I believe this is due to a design choice of quick-scope.

That sounds reasonable. Thanks for clearing it up!

mark2185 commented 1 year ago

I've just come across something that contradicts this, though.

image

Your explanation does explain why the m after the cursor isn't highlighted, but why isn't the m in maybe highlighted at all? The example from above at least highlights the second t, albeit in a secondary color since it's the second t.

bradford-smith94 commented 1 year ago

This one might require me to read through the target selection more closely, but I think it is probably skipping the m because the y is a first order target to get to that word. Since that word already has a first order target we don't need to search for other targets to get us to that word.

In the earlier example the t gets highlighted because it's a second order target (quick-scope doesn't consider beyond 2) and that word has no first order targets.

Does that help?

mark2185 commented 1 year ago

Alright, I'll take your word for it.

I guess I should just use what I get instead of trying to reason why I'm not getting what I want (even though what I want isn't the most useful so I should adjust my expectations)

Thanks once again! :)