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

Make m a special textobject identifier representing pair under cursor #956

Closed
EpocSquadron opened this issue Nov 2, 2021 · 2 comments · Fixed by #961
Closed

Make m a special textobject identifier representing pair under cursor #956

EpocSquadron opened this issue Nov 2, 2021 · 2 comments · Fixed by #961
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@EpocSquadron
Copy link
Contributor

EpocSquadron commented Nov 2, 2021

I got used to kakoune's m selecting everything in-between and including the brackets. Doing the same in helix requires using ma (since mm goes to the matching brace), which isn't so bad in and of itself. However it does require stopping to think which textobject is needed, as you might be on the character of any pair helix understands.

I propose adding m as a special textobject indicating whichever textobject is recognized under cursor. The result is one can reliably mam (or mim) from any pair character and get the intended result without reaching for the appropriate textobject identifier, improving the ergonomics of match mode for little cost.

If used inside a set of recognized nested textobjects, it would choose the closest. If none, it would do nothing.

@EpocSquadron EpocSquadron added the C-enhancement Category: Improvements label Nov 2, 2021
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 2, 2021
@sudormrfbin
Copy link
Member

This was actually a left over todo from #320 (vim-sandwich's b pretty much does what you described). The relevant code for surround matching is here if anyone wants to take a look.

@pickfire
Copy link
Contributor

pickfire commented Nov 2, 2021

I did a similar patch but for paragraph instead #784, maybe sooner or later when I need this I might write a patch for it, most likely I need quote more than bracket.

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

Successfully merging a pull request may close this issue.

4 participants