Closed EgZvor closed 2 years ago
This is intended. For example, put the line on a buffer.
ad
and then insert bc
in between a
and d
.
abcd
Now, if you type 0`[
, the cursor will be moved onto b
. On the other hand, if you type 0`]
, the cursor will be on d
, not c
. Vim-sandwich just follows the rule of how vim behaves when a string is inserted.
I usually think the marks are in between two characters rather than on a character, and the cursor comes to the right side of the mark always.
1 2 3 4 5
a b c d
If bc
is inserted, the range surrounding the inserted text is from 2 to 4. Therefore, 0`]
moves the cursor right after the 4.
That's what I suspected. I tried modifying the text object like this
xnoremap . `[o`]h
onoremap . <cmd>normal v.<cr>
but then the motion like gu
isn't registering correctly.
I think I'll create a thread in vim-dev group about this.
I've been experimenting with the last changed text text object
and found the following behaviour unintuitive (pipes signify the cursor)
Can this be fixed?