Last night I wrote a short piece the saved saved and exited (:wq). Then the goat-rope of trying to recover what apparently seemed to vanish stated. Since it was about 3 AM and I was getting no where, I stopped. Later today I tried again and miraculously the file was there. I again saved the filed as above. And yet, not so.

Over that last hour, I've figured out is that it's in another swap file that doesn't seem to list. In other words, while I keep getting pointed to "~/.local/share/nvim/swap//%Users%alex%Documents%Writings%blog%12Dec2021.md.swp"

what I really need is the same, only {stuff plus}.md.swo yet I'm only shown swm, swn, and swp as options.

Now, I copy and pasted what I found but everything is backwards. So it's not a total loss. But I also know this is likely something that's going to happen to someone again.

So, how does one recover a specific swapfile in vim?

  • Does the swo file exist? That's a first step; if it doesn't exist, that would explain why it's not an option.
    – D. Ben Knoble
    Dec 12, 2021 at 23:01
  • 2
    It does (which is why I know the file name)! But the fact that it only showed twice and I could never git it back on track with saving it is -- rather frustrating.
    – hrokr
    Dec 13, 2021 at 0:56
  • 2
    Can you have a look at this superuser.com/questions/204209/…. You should be able to recover your file using the .swp file
    – ashu
    Dec 13, 2021 at 8:38
  • @ashu - I tried that. It only recovers a couple of lines. But when I went into the .swo file, it had them all but put them from back to front -- which is kinda crazy.
    – hrokr
    Dec 14, 2021 at 20:52


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.