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

Update MotionQuoteAction.kt to support iq and aq motions #1081

Closed
wants to merge 0 commits into from

Conversation

oca159
Copy link

@oca159 oca159 commented Jan 8, 2025

Hi everyone,

I’d like to propose a new motion for editing text inside or around any type of quotes: ', ", or `.

The idea is to introduce motions like ciq, caq, diq, and daq to streamline these actions and make them more intuitive.

What do you think? Feedback is welcome! 😊

Notes:
I don't have experience with kotlin, so let me know if there is something wrong with my code change.

@AlexPl292
Copy link
Member

Hello, and thank you for your interest!
Since this is not a built-in Vim functionality, the additional text object should be defined as an extension. You can explore existing extensions like VimTextObjEntireExtension for reference.

Do you know of any existing Vim plugins with similar functionality?

@AlexPl292 AlexPl292 self-requested a review January 10, 2025 08:40
Copy link
Member

@AlexPl292 AlexPl292 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are above.

@oca159
Copy link
Author

oca159 commented Jan 10, 2025

Hi @AlexPl292!

Yes, I was exploring the functionality of this plugin: mini.ai. It allows me to use motions like ciq, caq, diq, and daq to work with any type of quotes, which I find incredibly useful.

It also supports motions like cib, cab, dib, and dab for working with parentheses, curly braces, and square brackets. I understand this might be a bit unconventional since the standard is b for parentheses and B for curly braces, but I find it super comfortable and intuitive to use.

I'll check out the JetBrains plugin documentation since I currently have no experience implementing something similar as a plugin. Thanks for pointing me in the right direction!

@Iamlooker
Copy link

Just a small pet peeve, Use of charArrayOf() would be just slightly better than list for cache locality (not very important for such small list). Mainly there is an object allocation with using Pair<Range, Quote> while we are not using Quote anywhere. Sorry if the PR is not complete 😅

@oca159
Copy link
Author

oca159 commented Jan 17, 2025

@Iamlooker, thanks for the feedback! 😊 I might consider creating a plugin to implement this feature in the future. I just need to learn Java or Kotlin first since I'm not experienced with them yet, haha

@Iamlooker
Copy link

Not at all, what you did is really awesome keep up

@citizenmatt
Copy link
Member

@oca159 you don't need to create a separate plugin. You could add this to the Extensions folder, unless @AlexPl292 would prefer to see it external?

@AlexPl292
Copy link
Member

AlexPl292 commented Jan 17, 2025

Yes, we can put it in IdeaVim repository, but as an extension, not as a core functionality.
The extension folder is this one: https://github.com/JetBrains/ideavim/tree/master/src/main/java/com/maddyhome/idea/vim/extension

@oca159
Copy link
Author

oca159 commented Jan 17, 2025

@Iamlooker , @AlexPl292 , @citizenmatt I created a new PR with the new extension, please take a look at it and let me know your feedback, as i mentioned, this is my first extension and i don't have too much experience with kotlin, any ideas, comments and suggestions are welcome. I tested my new extension and it works! you can do it as well with set mini-ai

@oca159
Copy link
Author

oca159 commented Jan 17, 2025

new pr: #1087

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

Successfully merging this pull request may close these issues.

4 participants