Loading ...
Sorry, an error occurred while loading the content.

Re: Creating a new undo block

Expand Messages
  • Spiros Bousbouras
    ... I tried function! Add_line() startinsert call feedkeys( u , nt ) stopinsert call append(0 , This is a new line ) endfunction imap :call
    Message 1 of 9 , Apr 2, 2009
    • 0 Attachment
      On 2 Apr, 13:35, Tobia Conforto <tobia.confo...@...> 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
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.