Recover a vim file from the .un~ file without the undo command

前端 未结 4 616
温柔的废话
温柔的废话 2021-02-12 20:10

How can I restore a vim file from the undo file without hitting undo?

I had a vim file that I saved while adding text. Then I ran a python comm

4条回答
  •  日久生厌
    2021-02-12 20:35

    It is not exactly possible, as the undo file only contains the text that was changed in a single change. If you at some point reloaded the file, the undofile should contain the complete buffer for that and starting from there one could theorectically recover the file (by going through the undo states).

    I have written about this before at the vim_use mailinglist here and here (which even contains a patch, that let's you force reading in the undo-file)

    You could try to patch vim and see if you can recover at least some data.

提交回复
热议问题