Andy Wokula wrote:
> I'm trying to get used to persistent undo, but hmmm, I find it still a
> bit difficult to use.
>
> What I want is persistent undo enabled for certain files (not enabled in
> the vimrc, I don't want all the undo files).
>
> So I thought it would be enough to :setlocal undofile when it's
> needed, and an easy and reliable setup would be to place 'undofile' in
> the modeline - this way I cannot forget to set the option for the file.
>
> But it doesn't work. What works is to set 'undofile' BEFORE editing the
> file (which is surprising, and I can't think of a technical reason).
>
> It would be nice if persistent undo would try harder to continue the
> undo history.
>
> Ideally, 'undofile' can be set at any time, and the undo file is loaded
> then (if 'undofile' was off); if possible, recent changes (collected
> while 'undofile' was off) are added to the history of the undo file,
> making up the new history.
>
> Comments?
It's not that easy, because when you set 'undofile' Vim has to compute a
checksum of the text to verify that it matches the undo file. Reloading
the file would be the simple solution. Adding code to separate the
functionality from reading the file is possible, requires some work.
Why not use an BufReadPre autocommand? Usually you can come up with a
file pattern (directory, extension) to decide whether to use 'undofile'.
--
hundred-and-one symptoms of being an internet addict:
67. Your hard drive crashes. You haven't logged in for two hours. You start
to twitch. You pick up the phone and manually dial your ISP's access
number. You try to hum to communicate with the modem. You succeed.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
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