Monday, July 27, 2015

Re: Persistent undo and force quit

Hi David!

On Mo, 20 Jul 2015, David Besen wrote:

> I have persistent undo turned on.  I noticed this behavior:
>
> - If I edit a file, make a change and don't save it, execute :qall!, edit the
> file again, and try to redo, the change is gone.
>
> - If I edit a file, make a change, undo it, save the file (essentially making
> no change to the file on disk), quit, edit the file again, and try to redo, the
> change is made!  The undo tree was saved even though there was no change to the
> file.
>
> I would like to get vim to save the undo history even if I make an edit and
> then execute :qall!.  Is there any way to do that?

undo files are only written, when the buffer is written. If you abort
editing, there is no reason to write something.

My guess is, it is avoided to make aborting work faster
since for writing the undo file, a hash of the buffer has to be
calculated and then the undo file needs to be written, which also might
take some time.

Now imagine several large buffers and a slow network file system.

You could possibly script something using the mentioned wundo command
and a VimLeave autocommand.

Best,
Christian
--
Eine Million Steuerzahler verhalten sich vernünftiger als eine
öffentliche Hand.
-- Hermann Josef Abs

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment