Repository: neovim
Issue: Force Read Undo File from beginning: Bring forth `:rundo!`
Labels: enhancement,has:vim-patch,editor-state

### Problem

When using "unlimited" persistent undo we generally have in the undofile the full logical information of the last version of a file (at least up to the last time I opened it in vim).

Some `git` (and other) mishaps can delete the file or revert it to a different version which according to the **public neovim API** makes the undofile unusable. But it's only unusable if we consider the current copy to be the correct version of the file and thus needing to be a leaf in the undofile.

However, 

1. if saved from the beginning of the life of the file. We could force reading the undo file from an empty file and recover the file entirely **and** with its undo history intact.
2. Furthermore, even if we didn't keep the full undo history from the beginning (maybe such an issue already happened in the past, and so the undo history has effectively been truncated of everything before this date), replaying the undofile from an empty file will still give us the correct last version of the file and all the history we still have.
3. *

### Research

- I have seen that you @chrisbra personally made a patch for exactly this at least 12 years ago for Vim which was aptly called [`:rundo!`](https://groups.google.com/g/vim_use/c/pOia0eB8ZWo/m/FmIQ4lUOPDIJ) to *force* reading the undofile.
- I have found that you published another patch 3 years later to add [`:undorecover`](https://github.com/chrisbra/vim-mq-patches/blob/master/undorecover), which if I understood well has the same purpose but with a more polite way to "force" reading the undofile
- I also noticed that the current [Vim Todo](https://vimhelp.org/todo.txt.html) still mentions *considering* adding the patch that is now 9 years old, meaning it hasn't been added.

I haven't been able to find any more information on this topic online, nothing in issues for both projects.

That's the feature that I have most wished for since I literally started using Vim and personally feel like it would be an absolute life changer in the text editing space. We would virtually have an unlimited file undo history through the whole life of a file.

### Question

So, my current question @chrisbra is, is there an equivalent patch I could use in neovim, quickly adapted from these patches, or would this now need a complete rewrite of the feature with the current state of the codebase, now a fork and 10 years in the future ? 

If not, as a last resort, do you think it would possible to compile Vim rolled back to the commit in history when this patch was made (or even the current release if the patch could be adapted with a few changes), load the (1000 empty lines) file with my undofile (made with Nvim 0.9.2.2) and run `:rundo!` successfully recover my file to its last saved version, or did the codebases diverge too much since then to be of any use ?

Thanks a lot in advance, (I am trying to recover a precious file I know the corresponding undofile still has all the information in it.)



PS: I've read the code around the definition of `u_read_undo` in both codebases (neovim and vim) and would be glad to try spending time at implementing I could be guided towards the right direction, I unfortunately am far from proficient enough in C to be able to tackle such a foundational and performance-needing feature by myself...

*: I believe we could also even additionally add the observed current state when opening `nvim` as the new leaf in the undo tree right after the last saved state in order to continually use the undo history without any problem no matter what happens to the file, with losing the undofile itself being the only left risk.


### Expected behavior

Run `:rundo!` on a file with a corresponding undofile, and have the buffer modified to be in the last state saved in the undofile.