-
Notifications
You must be signed in to change notification settings - Fork 217
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
[mini.ai] textobject selection places cursor at the beginning instead of the end of the selection #1448
Comments
Thanks for the suggestion! If I remember correctly the main motivation for this behavior is to be consistent with how cursor is placed after operating on textobject. This is explicitly documented while cursor placement after visual selection is more of an implementation detail. At least I am not aware of the explicit documentation on the matter. This was previously closed as not planned (but I can not find right now), but I'll revisit later (and also take a look at whether there are more important implementation reasons for that in 'mini.ai'). |
Thank you for your response and for explaining the design decision! Based on my testing, in Neovim, after selecting a region and pressing This leads to a noticeable difference: for example, yiw leaves the cursor at the start of the word, while viw moves the cursor to the end of the word. If you follow viw with y (viw + y), the cursor first moves to the end of the selection (due to viw) and then returns to the start (due to y). I’m not entirely sure why Vim was designed this way, but this has been the default behavior I’ve grown accustomed to over the years. It feels natural to me. If it’s possible to add a parameter or configuration option to control this behavior in |
There definitely won't be an option for this. I'll revisit and rethink about all pros and cons of putting cursor at the end vs the start. Right now I am leaning towards keeping current behavior, but we'll see. |
This better aligns with how it is done for built-in textobjects, which especially matters with "overlapping" textobjects (like a)/i"/etc.). Resolve #1448
This should now be resolved on latest |
Contributing guidelines
Module(s)
mini.ai
Description
When using textobjects provided by
mini.ai
in Visual mode (e.g.,vi)
orvi"
), the cursor is placed at the beginning of the selection. However, Neovim's default behavior places the cursor at the end of the selection.This creates an inconsistency between
mini.ai
textobjects and Neovim's default textobjects. For example:viw
places the cursor at the end of the selected word.vi)
places the cursor at the beginning of the selected parentheses.This behavior is unexpected for users accustomed to Neovim's default textobject behavior.
Would it be possible to:
Neovim version
0.10.3
Steps to reproduce
mini.ai
enabled.This is (a test)
or"some text"
.vi)
orvi"
to select the textobject.Expected behavior
The cursor should be placed at the end of the selected textobject, matching Neovim's default behavior.
Actual behavior
The cursor is placed at the beginning of the selected textobject.
The text was updated successfully, but these errors were encountered: