What Is a .SWO File?
You found a .swo file next to your document and Vim is warning you. It is Vim's second swap file. Here is why it exists and how to clear it.
What a .swo file is
A .swo file is a Vim swap file — the same kind of crash-recovery file as a .swp, but with a different letter. Vim names its first swap file .swp. If a .swp already exists for the same document (because another Vim session has it open, or a previous session crashed and left one behind), Vim cannot reuse that name, so it creates a second swap file ending in .swo instead.
Why you are seeing a .swo instead of a .swp
The extra letter is Vim's fallback naming: .swp first, then .swo, then .swn, and so on backwards through the alphabet. A .swo almost always means the document was already open somewhere, or an old swap file was never cleaned up.
How to recover your work from a .swo
Open the original file in Vim and choose (R)ecover at the prompt, or run vim -r yourfile. Vim reads the swap file (it will pick up the .swo automatically), restores the unsaved changes, and lets you save them. Compare the recovered text to what is on disk before you overwrite anything.
Is it safe to delete a .swo file?
Yes — once you have recovered any unsaved edits, or decided you do not need them. Deleting the .swo only removes the recovery copy, never your real file. On Linux and macOS the file is hidden (its name starts with a dot); use ls -a to see it and rm .yourfile.swo to remove it. On Windows, Neovim behaves the same way.
Common problem: Vim keeps warning after you close
If Vim still complains that a swap file exists after you quit, a stale .swo (or .swp) is sitting in the folder. Recover once with vim -r, save, then delete the leftover swap file to stop the warning for good.
FAQ
What is the difference between .swp and .swo?
Both are Vim swap files. Vim makes a .swp first; if that name is already taken it makes a .swo, then a .swn, and so on. They serve the same crash-recovery purpose.
How do I recover from a .swo file?
Open the file in Vim and choose (R)ecover, or run vim -r yourfile, then save the restored text.
Is it safe to delete a .swo file?
Yes, after you have recovered any unsaved changes. Deleting it removes only the recovery copy, not your document.
Why did Vim make a .swo instead of a .swp?
Because a .swp for the same file already existed — usually the file is open in another Vim session or a previous session crashed.