function! Add_line()
call append(0 , "This is a new line")
endfunction
imap <F1> <ESC>:call Add_line()<CR>
The above script gets executed and now I am in Insert mode. I
type a few characters and then press <F1>. As expected "This is
a new line" is added at the top of the buffer. Now if I press 'u'
it removes the new line *and* the characters I had typed right
before I pressed <F1>. Is there a way to modify the function
(preferably) or the mapping so that when I press <F1> a new undo
block is created so that when I press 'u' only the modification
by Add_line() gets undone and not what came before I pressed
<F1> ?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---