chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
248 stars 25 forks source link

recover#RecoverFinish() does not delete swap file #38

Closed PhilRunninger closed 8 years ago

PhilRunninger commented 9 years ago

In my vimrc, I have the set directory=$VIMHOME/tmp/swapfiles// statement to keep my development folders clear of swap files. I am running vim 7.4.712 on MacOSX. After vim crashes, my preferred choice is to use the Diff in your plugin to examine the differences. When I'm done, using either :RecoverPluginFinish or :RecoverPluginGet, I think all is well. That is, until I edit the file again, and I go through the same operation. I traced it down to the call delete(fnameescape(swapname)) statement in recover#RecoverFinish(). The delete() function is returning a -2.

At the time the error occurred, the value of swapname is /Users/prunninger/.vim/tmp/swapfiles//%Users%prunninger%junk%foo.txt.swp, which fnameescape changes to /Users/prunninger/.vim/tmp/swapfiles//\%Users\%prunninger\%junk\%foo.txt.swp.

As I stated in my StackOverflow question, I suspect bad escaping, pointing to a nonexistent file, rather than a permission issue.

chrisbra commented 9 years ago

So removing the fnameescape() call should be safe?

chrisbra commented 9 years ago

Please check current head, if this works for you

PhilRunninger commented 9 years ago

That did the trick. Thanks for the quick response.