I just opened a long code file in VIM and got the message that a temporary swap file for the file already exists. Both the temporary swap file and the extant file have identical timestamps. I would like to diff them, but the temporary swap file is binary. Can VIM show to me the differences between the two files?

Note that I tried to open the temporary swap file with the "Recover" option in VIM and then just vimdiff it with the extant file. However, that gave to me the message "Recovery completed. Buffer contents equals file contents" which is nice to know, but I would still like to know how to diff the files beforehand in the event that they don't match. In that case, is it still viable to open the temporary swap file in VIM and then vimdiff it with the extant file?


Have a look at the recover.vim plugin. It installs a hook that asks you what to do when a swap file has been detected, and offers to show a diff.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.