Tuesday, May 31, 2011

Re: Restore file from undo

Christian Brabandt wrote:

> On Tue, May 31, 2011 1:50 pm, Vsevolod Velichko wrote:
> > Christian, thanks for your answer.
> > Yes, all the files I've lost were created from scratch, so I suppose,
> > that undofile contains all the file history (undolevels=1000 should be
> > sufficient for every file).
>
> Ok then here is a patch. It allows to use :rundo! to let vim read in any
> undo file. You need to create a new empty file with more lines, than your
> original file had, e.g. 1000 empty lines. Then do :rundo! original_file.un~
> and you can move through the undo history using g- and g+ or using
> the :earlier :later commands.
> The histwin or gundo plugin may also come useful to see your different
> undo branches.

This is an interesting idea. Not only when the file was deleted, but
also when it was changed by another program.

Perhaps we can have a "starting point" marker in the undo file, where
the base file is completely empty. From there it's always possible to
repeat changes. With some command to do this, perhaps ":undorecover"?

When trying to load the undo file and the hash doesn't match, and there
is a starting point marker, we could give the user a hint that
:undorecover can be used.

--
I'm writing a book. I've got the page numbers done.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
You received this message from the "vim_use" 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

No comments:

Post a Comment