unblevable / quick-scope

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

How to use with repmo and g:qs_highlight_on_keys #79

Open HaleTom opened 2 years ago

HaleTom commented 2 years ago

I want to reduce visual noise, so turn off highlighting until a motion key is pressed:

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

However, when I'm using repmo-vim (repeat motion), it doesn't work as expected:

I can't press fa to go to the first a, then use repmo's ; to repeat the motion and jump to the next a.

What happens when pressing ; is that all the jumpable targets are highlighted.

repmo config:

nmap <expr> f repmo#Key('<Plug>(QuickScopef)', '<Plug>(QuickScopeF)')
nmap <expr> F repmo#Key('<Plug>(QuickScopeF)', '<Plug>(QuickScopef)')
bradford-smith94 commented 2 years ago

I'm not exactly sure, as this is the first I've heard of repmo-vim, but I think this may be due to how you've set the "reverse motion".

Quick-scope isn't doing any motion itself, what the mapping is doing is simply providing the target highlighting and then capturing the next character pressed. It then returns the motion character and the target that it captured (i.e. fa) so that Vim handles the motion as it would by default. So both the forward and backward motions you have in your example should land you inside a quick-scope function waiting for you to press another key (with targets highlighted), if repmo-vim is expecting the "reverse motion" to simply put the cursor back to where it came from, then I don't think it will.

You may want to ask for help in repmo-vim, as I don't really know what it's settings are expecting. If you end up needing a quick-scope based solution for this you might want to follow https://github.com/unblevable/quick-scope/issues/78. When that issue gets resolved you may be able to set something like:

nmap <expr> f repmo#Key('<Plug>(QuickScopef)', '<C-o>')