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

Highlight matching parenthesis before the cursor #11333

Closed
ArthaTi opened this issue Jul 26, 2024 · 5 comments
Closed

Highlight matching parenthesis before the cursor #11333

ArthaTi opened this issue Jul 26, 2024 · 5 comments
Labels
C-enhancement Category: Improvements

Comments

@ArthaTi
Copy link

ArthaTi commented Jul 26, 2024

Consider a scenario where I'm closing a number of consecutive parentheses. While typing, it is most handy to have the opening parenthesis highlighted to match the one I have just closed — this way I can easily figure out how many parentheses remain to insert. For example, here, I have just inserted a closing paren that matches the opening paren to call on line 8. I would expect it to be highlighted.

Screenshot-20240726-045925

This can be seen in action in other editors, for example, in Vim:

image

Helix already has a paren-matching feature, but it happens to only highlight parentheses that exactly match the current selection cursor position, and so, is useless in this case. It would be very helpful to include the previous character. Note that Vim uses the previous character only if there is no match on the current position, which I believe is the best behavior.

@ArthaTi ArthaTi added the C-enhancement Category: Improvements label Jul 26, 2024
@jerabaul29
Copy link
Contributor

Agree that would be nice. Not sure if there are synergies with #2857 .

@TheZoq2
Copy link
Contributor

TheZoq2 commented Aug 8, 2024

I requested a similar feature a while back #8547

@the-mikedavis
Copy link
Member

Yeah this is a duplicate of #8548

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2024
@TheZoq2
Copy link
Contributor

TheZoq2 commented Aug 10, 2024

Would it be possible to reconsider this? While I see the point of "semantically this is strange", I don't think it'd cause confusion and now that I'm back on helix I'm still noticing that I have a harder time closing matching braces correctly.

As @jba suggested in #8548 it could even be a config flag for those of us who really like this behaviour

@jba
Copy link

jba commented Aug 11, 2024

@TheZoq2 I have a commit that does this. I've been running off of my local build for months. I could share it with you if this doesn't go forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

5 participants