On Mo, 28 Okt 2013, erdogan.kerem wrote:

> Hi, 
> 
> I just enabled persistent undo in vim, but realized that before turning on
> persistent undo, it was occasionally useful debugging for me to undo my
> changes until when I first opened the file, then play them back to see if I
> had made any unintended changes. With persistent undo, however, I'm not sure
> how to know when I get back to the state in which I first opened the file.
> Does anyone have any ideas on how to find this out with persistent undo
> enabled?

That is not easily possible, because Vim doesn't keep track of the time, 
when you first opened the file. May be this helps:

aug MyPersistentUndo
  au!
  au BufNewFile,BufReadPost * :let b:undo_nr = changenr() | com -buffer 
ResetOpenedFile :exe (b:undo_nr ? ":undo ". b:undo_nr : ':undo 1|norm! g-')
augroup END

And then use :ResetOpenedFile to go back to the time, when you first 
opened the buffer.


Best,
Christian

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to