I have some text selected in select mode. I want to delete it and start insert-mode completion.
When I type these keystrokes into Vim it works perfectly:
gv switches to visual mode;
c changes / cuts the selection and switches to insert mode; and the rest triggers insert-mode completion.
However when I try to this from Vimscript it doesn't work:
execute "normal! gvc\<C-X>\<C-U>"
gv part works but the
c cuts a character extra at the right hand end of the selection, and the cursor ends up one character before where I want it (in insert mode, which is correct), and the completion doesn't start.
For example, if
bar is selected in the following line:
– then after my
execute "normal! ..." I am left with:
– with the cursor just before the bracket. What I want is
foo(, baz with the cursor just after the bracket and the completion menu open.
How can I get this working via Vimscript?