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

FR: Optional Highlight the position % would jump to #292

Open
chrisgrieser opened this issue May 30, 2023 · 1 comment
Open

FR: Optional Highlight the position % would jump to #292

chrisgrieser opened this issue May 30, 2023 · 1 comment

Comments

@chrisgrieser
Copy link

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

@andymass
Copy link
Owner

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

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

No branches or pull requests

2 participants