whatfileis.pro
Paste a filename and find out what it is, whether it is safe, and what opens it.

What Is a .SWP File?

Vim left a .swp file and now warns you when you open the document. It is a crash-recovery file. Here is how to recover or clear it.

Category
Safe to delete?
Opens with

What a .swp file is

A .swp file is Vim's swap file — a running record of your unsaved changes, kept so it can recover your work if Vim or the machine crashes. It is normally hidden (name starts with a dot) and sits next to the file you edited.

Why Vim warns you

If a .swp already exists when you open a file, either the file is open in another Vim session or a previous session crashed. Vim shows a recovery prompt.

How to recover your work

Open the file and run :recover, or start Vim with vim -r yourfile. Compare the recovered text to the file on disk, save what you want, then delete the swap file.

Is it safe to delete?

Yes, once you have recovered (or don't need) the unsaved changes. Delete the .swp and Vim stops warning. If the file is currently open elsewhere, close that session first.

FAQ

How do I recover from a .swp file?

Open the file and run :recover, or launch vim -r yourfile, then save the text you want to keep.

Is it safe to delete a .swp file?

Yes, after you have recovered any unsaved changes or decided you don't need them.

Why does Vim keep making .swp files?

It writes them automatically to protect unsaved edits. You can disable them with :set noswapfile, but you lose crash recovery.