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

FR: Optional Highlight the position `%` would jump to

Open chrisgrieser opened this issue 2 years ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe. When you are not on a bracket or (keyword with a counterpart), you do not get any matchparen-like highlighting. In those cases, using % is sometimes a bit hard to predict.

Describe the solution you'd like An option to highlight the position % would jump to, even when not on a bracket.

Describe alternatives you've considered I couldn't really think of any

Additional context Highlighting the position where a motion would move to is really more useful than one would think in my view. Using an extra colorcolumn helped me learning gm, and without quickscope, I wouldn't use ft as much. I think making % more predictable with a highlight would make the whole motion more popular

chrisgrieser avatar May 30 '23 17:05 chrisgrieser

So there is :help g:matchup_matchparen_hi_surround_always but it's not equivalent to what you're asking for.

The logic for this is actually quite simple and has been the same since the time of vi.

  1. Scan ahead for the next "active" text- by default ({[)}] but depends on the file type. b. If the cursor was already on active text, don't move.
  2. Jump to the match of the text found in 1.

I guess it's reasonable to highlight that target (which is not the same as surrounding pairs).

andymass avatar May 30 '23 22:05 andymass