-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 AnyQuotes support for unified quote handling similar to mini.ai nvim #22263
base: main
Are you sure you want to change the base?
Conversation
This commit introduces a new AnyQuotes text object to handle text surrounded by single quotes ('), double quotes ("), or back quotes (`) seamlessly. The following changes are included: - Added AnyQuotes to the Object enum to represent the new feature. - Registered AnyQuotes as an action in the actions! macro and register function to ensure proper integration with Vim actions like ci, ca, di, and da. - Extended Object::range to check for surrounding single, double, or back quotes sequentially. - Updated methods like is_multiline and always_expands_both_ways to ensure consistent behavior with other text objects. - Added support in surrounding_markers to evaluate any of the quote types when AnyQuotes is invoked. - This enhancement provides users with a flexible and unified way to interact with text objects enclosed by different types of quotes.
This commit adds comprehensive tests for the new AnyQuotes text object, ensuring proper functionality and robustness. The following tests were included: Basic Operations: Verify ciq, caq, diq, daq, viq, and vaq commands for single quotes ('), double quotes ("), and backticks (`). Edge Cases: Test nested quotes (e.g., ' " " '), mixed quotes, and quotes with escape characters (e.g., 'It's escaped'`). Multiline Scenarios: Validate behavior for multiline quotes across single, double, and backtick variants. Visual Mode: Ensure proper visual selection inside and around quotes. These tests provide full coverage for the AnyQuotes object, ensuring it behaves consistently across various scenarios and edge cases.
We require contributors to sign our Contributor License Agreement, and we don't have @oca159 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
"t": "vim::Tag", | ||
"s": "vim::Sentence", | ||
"p": "vim::Paragraph", | ||
"'": "vim::Quotes", | ||
"`": "vim::BackQuotes", | ||
"\"": "vim::DoubleQuotes", | ||
"q": "vim::AnyQuotes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important code change, all the other changes in this file is just formatting
Edit 1:
I tested it locally and it works!
IMPORTANT:
Feedback and suggestions for improvement are greatly appreciated!
This commit introduces a new AnyQuotes text object to handle text surrounded by single quotes ('), double quotes ("), or back quotes (`) seamlessly. The following changes are included: