0

I'm trying to configure Vim to make it so that if my system crashes I can recover my work from swap files set in set directory=.

I tested this out on Vim in Windows using gVim. If I forcibly crash Vim to test this out, when I reopen vim I get an alert about my swap files like so: 'Swap file "~\.vim\scratch_files\swap//C%%Path%To%WorkingDirectory%Filename.txt.swp" already exists!' [Open Read-Only] [Edit anyway] [Recover] [Delete it] [Quit] [Abort]

However, it only recovers files that I have previously saved. Anything that I had in an empty buffer prior to when it was saved (any unsaved files) doesn't have a swap to recover.

Is there a way to get Vim to create swap files for new files I hadn't yet saved? / Is there any way to recover new files after a crash?

  • I believe swap files for unnamed buffers are just called .swp, .swo, etc. You can use :recover .swp to recover from the file .swp in the current directory. – Christian Brabandt Apr 17 at 14:48
  • There was no .swp file created unfortunately. I'm not sure why. – Incalculon Apr 18 at 1:26

Your Answer

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

Browse other questions tagged or ask your own question.