-
Notifications
You must be signed in to change notification settings - Fork 2
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 ai
text object
#2
Comments
Thank you for the kind words, and using my plugin! You are raising two valid points here. Let's have a discussion to understands what needs to be done. Regarding
|
First of all I realize now that your plugin operates in visual mode and not in visual-line mode. I think it makes more sense to operate in visual-line mode since each indent is per line. I think in your example 11
aa
bb|
bb
cc
22 it makes more sense to me if doing 11
aa
|
cc
22 i.e. that the indentation level is preserved. My guess is that switching to visual-line mode will give this behaviour more or less automagically. Most of my thoughts here come from using the plugin vim-indent-object. I think it is very intuitive to use, perhaps give it a try to get a feel for what feels intuitive. I realize also that the behaviour of 11
aa
<
<
bb| < ii < ai
bb < <
< <
bb < <
<
cc
22
Either that, or
vim-indent-object seems to select based on the "lowest" (leftmost) indendation level that is selected, but it would also make sense to me to select only based on the indendation level of the line that the cursor is on (i.e. as if the selection was made from normal mode). |
Hi, sorry for the delay. You are making good points, let me play around with your ideas and will get back to you. |
This commit fixes the cii when it is not correctly putting the cursor in the right place after the change. Thanks to @melkster for the idea. Ref #2
This commit expects the opts table to provide a table for the ai and ii text object settings. This will break if you have a previous version, which used to accept a string. Ref #2
I have implemented the Let me think about the |
Thanks for making a great plugin! I just switched to this one from vim-indent-object, and I noticed that this plugin doesn't support the
ai
text-object like vim-indent-object does. It is very useful when in visual mode and you've selected an indentation withii
, because then you can keep hittingai
to select the next indentation level. The mnemonic forai
is "around indendation", just like how (at least to me)ii
reads "inside indendation".For example, pressing
vii
with the cursor on the line with the comment "cursor here", and then pressingai
expands your selection to the next indendation level:The text was updated successfully, but these errors were encountered: