On 2 Apr, 13:35, Tobia Conforto <[email protected]> wrote:
> Spiros Bousbouras wrote:
> > Anyone knows if it's possible to achieve the same effect from within
> > a script ?
>
> Maybe you could try ending insert mode and entering it again?
> See :stopinsert and :startinsert
> Or you could send the <c-g>u from within the function, using
> feedkeys() with the t option, as Ben suggested.

I tried

function! Add_line()
    startinsert
    call feedkeys("\<C-G>u", "nt")
    stopinsert
    call append(0 , "This is a new line")
endfunction
imap <F1> <ESC>:call Add_line()<CR>

but it doesn't bring the desired result.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to