Closed kiryph closed 9 years ago
It's probably because they intersect. Try cxip
instead.
That works. Thanks for your reply.
So I go with cxip
. I am wondering: Is there a use case for cxap
?
And another question: does exchange.vim
only works if there is no intersection?
Generally, I find I only use the a
variant of text objects with the d
operator. There are occasionally other use cases but it's hard to come up with them on the spot.
Yes, exchange.vim only works when there is no intersection in the two regions of text. That's because it's not obvious what to do (i.e. what the user expects) in that scenario.
Actually in this case the following approach would work: Consider two overlapping regions []
and ()
in this example:
,,,,,,,,,
aaa[bbb(ccc]ddd)eee
^^^^^^^^^
By switching the overlapping ends we would get:
,,,,,
aaa[bbb]ccc(ddd)eee
^^^^^
Which could be exchanged as usual. In the case above this would exclude the shared blank line from both paragraph regions and exchange the inner paragraphs as expected. Not sure if there's any downside though.
I considered this option, and will continue to think about it.
I think Visual-block mode will present a lot of challenges -- perhaps unsolvable ones.
Consider following text file:
I'd like to exchange both paragraphs. I do
cxap
on first paragraph and.
on last paragraph. But it happens nothing. It works when I add a blank line at eof.