>> Adding the ability to easily diff the recovered buffer >> against the on-disk file (the action recommended to the user) >> is a valid request. > I'm not proposing the following as a solution, but I will > mention that there is a related tip: > http://vim.wikia.com/wiki/Swap_file_%22...%22already_exists!_-_so_diff_it
And the 'Comment' at the end of the tip, IMHO, is the most useful part. Here's what I usually do. When I'm confronted with the 'Swap file exists' message, I choose 'Recover' and then immediately issue :DiffOrig (:help :DiffOrig). Once I've considered the changes, I either (1) close the Scratch buffer that is the original file, to keep the recovered file, and delete the old swap file, or (2) I edit the file again and choose 'Delete' when confronted with the 'Swap file exists' message. Now, perhaps a good solution is to have (1) a 'Recover and diff' option that basically does 'Recover' and :DiffOrig in one step and (2) a :KeepThis command that you can run in the buffer you're interested in keeping, that writes the buffer you're editing to disk (you may have even edited it, e.g. to incorporate *some* changes from a recovered version), deletes all the stale swap files, closes any other buffers that were editing that file (to avoid 'Buffer already editing that file' issues, etc.), and re-edits the file so that its current swap file is .swp not .swo and thus easily recoverable in future. It would need a little support from Vim--i.e. a reliable way to determine what the swap files are, both current ones for buffers being edited, and stale ones, i.e. ones from which recovery was done. That is probably easy to add. But apart from that, it could be Vimscripted, I think. So, two big questions about it. (1) Would my suggestion be an appropriate interface? and (2) Would Bram be willing to have those small additions to Vim? Ben. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
