Mun schrieb:
> Hi all,
>
> I have been using the Persistent Undo patch for several months now and I
> have a general comment regarding it's usability.  Jordan and I had a
> private conversation about this a while back, and he requested I post
> something to the list so as to provide a broader audience for feedback.
>
> Note that I have set the 'undofile' option in my .vimrc because I don't
> want to have to remember to use :wundo .
>
> Often times I need to make a _temporary_ change to a file; so I make the
> change and save it without exiting.  After doing whatever I need to with
> the altered file I generally want to quickly revert back to the
> "original" file (i.e., back to the file contents as they were prior to
> the *current* editing session).  In the past, I would do something like
> "1000u" and then save it and exit.  But with undofile set, if an
> undofile exits and is applicable, the saved edits will be undone as
> well.  Of course, this is by design.  But I would prefer an easy way to
> undo everything up to the point of reading the undofile while keeping
> "set undofile" specified in my .vimrc .
>
> Perhaps one way of doing this would be if instead of the single
> 'undofile' option we had 'writeundofile' and 'readundofile'?  That way I
> could set my .vimrc to always write out the undo file, but only read it
> in when I used :rundo .  Although, this is not backward compatible with
> the current patch.
>
> Another possibility would be for 'undofile' to be a string variable with
> possible choices being something like "read, write, both".  Where "both"
> is the default for backward compatibility.
>
> Regards,

What about checking the modified option?  (very pseudo cody ...):
Undo one step, undo more steps until the buffer is not modified -- "not
modified" is assumed to be the case when starting to edit a buffer.
    undo
    while &modified && CanUndo()
       undo
    endwhile
(or wrap :undo in a try-block which :breaks on error)


Or check this script:  undo_tags
http://vim.sf.net/scripts/script.php?script_id=1997


Or try to use an autocommand:
    :au BufRead * let b:undo_start_nr = changenr()
    :com! Revert exec "undo" b:undo_start_nr


This is untested, and I don't know what will work together with the
patch.  But I'm sure there will be a way without the need to add more
Vim options.

-- 
Andy

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui