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

57203Re: [vim73] easy way to purge 'persistence undo'?

Expand Messages
  • SungHyun Nam
    Jun 3, 2010
      SungHyun Nam wrote:
      > Dominique Pellé wrote:
      >> Christian Brabandt wrote:
      >>> On Do, 03 Jun 2010, SungHyun Nam wrote:
      >>>> With vim-7.3 (+ 'undofile'):
      >>>> I guess I could remove a undofile and run ':e' to do this. Maybe
      >>>> I can make a mapping with some vim script, but...
      >>>> Is there any easy way to purge 'persistence undo' history?
      > And I made a function, it works for me.
      > func! util#purgeUndoHistory()
      > let file = undofile(expand('%:p'))
      > if filereadable(file)
      > let oldundofile = &l:undofile
      > setl noundofile
      > silent! exec "!rm -f ".file
      > e
      > let &l:undofile = oldundofile
      > endif
      > endfunc

      No, it did NOT work. :-(
      Edit and save a 'file.c', and...
      $ vim file.c
      :call util#purgeUndoHistory()
      And if I type 'u', vim displays:
      Already at oldest change

      But, when I exit VIM and open the file.c again, 'u' works again.

      And I found the undofile was not removed. The exec line should be
      changed to:
      silent! exec "!rm -f ".escape(file, '%')


      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 10 messages in this topic