machakann / vim-sandwich

Set of operators and textobjects to search/select/edit sandwiched texts.
1.44k stars 37 forks source link

Unexpected cursor position when using i_CTRL-o to add surroundings #67

Open kiryph opened 6 years ago

kiryph commented 6 years ago

Right now vim-sandwich does not return to the desired cursor position in following example.

Current behavior:

word| Ctrl-o ysiw' positions the cursor as following: '|word'

Expected behavior:

word| Ctrl-o ysiw' should position the cursor as following: 'word'|

| denotes the cursor position. I am using the vim-surround mappings described in the documentation.

I came across this issue on the vim-surround issue tracker: https://github.com/tpope/vim-surround/issues/253

machakann commented 6 years ago

Good catch, thank you! I reproduced the problem. It seems different if not using vim-surround style mapping.

I will check it in this weekends

machakann commented 6 years ago

It seems difficult to fix this currently. The current behavior is correct in normal mode. Thus, we need to implement different logic for cursor placement.

The problem is there is no way to realize the use of Ctrl-o inside a script. Probably, we need this patch. vim/vim#3000

bew commented 4 years ago

Hello! Just a friendly ping as the patch you mentionned in your last message has been merged