Feel free to close this as a dupe if you can find a question that deals with this case.
This is NOT about HOW to recover a .swp file in vi.
I'm not sure if I want to recover. I want to preview what I'll be changing if I do, and in a non destructive way.
Unfortunately typing vi .myfile.swp
shows me what looks like binary gobblety gook.
To make my current state clear, I believe no one is currently editing the file. I happen to be looking at an overzealous copy of a dir that apparently happened while the file was open.
My current plan is to copy myfile to myfile-temp and then recover myfile. Then inspect for differences.
Is there a better way?
block0
(C) that is written to the start of the swap. Among the properties of the struct is the file nameb0_fname
. If you open the swap file in Vim you should be able to locate this field at the top (byte 100+/-) What you need to do is either create a new directory where you copy the swap file and source, or you can edit the swap file IFF you give it a name of same length as original. The latter is more for hack and fun ... Recovering by swap is by default non-destructive for the original file as well as original swap. (Unless:w
):sav another_file_name
and then diff original_file_name and another_file_name ... Perhaps play around with some test files first ...