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, '%')
Thanks,
namsh
--
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