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

Add ability to match in next and previous char pairs #11260

Conversation

thomasschafer
Copy link
Contributor

@thomasschafer thomasschafer commented Jul 21, 2024

Adds the ability to match inside/around the next or previous matching character pair: for instance, with the cursor as below:

let x = "bar";

typing ]" would select the contents of the string (i.e. bar).

Screen.Recording.2024-07-21.at.22.30.56.mov

This is a modified version of this PR, based on the discussion there.

Partially resolves:

@thomasschafer thomasschafer force-pushed the tschafer-add-go-to-next-inner-matching-chars branch 2 times, most recently from 9f39370 to 7bd2104 Compare July 21, 2024 15:49
@thomasschafer thomasschafer marked this pull request as draft July 21, 2024 15:58
@kirawi kirawi added the A-command Area: Commands label Jul 21, 2024
@thomasschafer thomasschafer marked this pull request as ready for review July 21, 2024 21:07
@thomasschafer thomasschafer force-pushed the tschafer-add-go-to-next-inner-matching-chars branch from ab0a365 to 1e476c2 Compare July 21, 2024 21:23
@thomasschafer
Copy link
Contributor Author

I've realised that I haven't taken into account this comment about using a fallback command rather than an on-next-key callback - I'm happy to rewrite this PR using that idea instead if desired

@pascalkuthe
Copy link
Member

yeah I wouldn't want to change the default keymap like this. I think Mikes idea about adding a generic notion of a fallback command is a good idea. Could be particularly useful for plugins/user keymaps in the future.

@the-mikedavis
Copy link
Member

For this PR I was imagining we could start with adding a goto next "any pair" command since that wouldn't need changes to the keymap code or an on-next-key. I'll try to clean up my fallback command changes and submit a PR for that so we can add the versions where you jump to a specified pair too

@thomasschafer
Copy link
Contributor Author

For this PR I was imagining we could start with adding a goto next "any pair" command since that wouldn't need changes to the keymap code or an on-next-key. I'll try to clean up my fallback command changes and submit a PR for that so we can add the versions where you jump to a specified pair too

Sounds good - I'll update my PR when that's in. Thank you both!

@pascalkuthe pascalkuthe added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 27, 2024
@thomasschafer
Copy link
Contributor Author

Closing in favour of #11695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants