THE FILE FIELD GUIDE
.swp

Swap File

Temporary & Downloads

SWP commonly names Vim swap data for recovering unsaved changes, distinct from a simple BAK. Check for another active editing session and preserve both original/swap. Save recovered text separately and compare before overwriting or discarding anything.

What it is used for
Recovering in-progress text editing
What the file contains
Partial / temporary data
All sections, questions and sources

Content reviewed: · Editor:Kai

Opening steps

Choose your environment or purpose to see its steps.

Identify a Vim swap file

Check active editing first.

  1. Inspect source name, swap location/time and warning host/process information.
  2. If another Vim session is active, inspect its ongoing work first.
  3. For crash recovery retain copies of source and swap.
Recover in Vim

Recovery can depend on the source file too.

  1. Use the supported vim -r source-file workflow for a trusted candidate.
  2. Inspect warnings and questionable/missing lines in the recovery.
  3. Write the recovery to a separate file rather than overwriting source.
Compare and validate recovery

Remove swap only after validation.

  1. Compare source and recovery with a diff.
  2. Check for required unsaved edits, missing sections and duplicates.
  3. Secure a verified saved result before cleaning up obsolete candidates.

Menu labels and support vary by app, OS and version. Preserve the original before making changes.

Troubleshooting by symptom

  • Existing-swap warning: distinguish active editing from a crash remnant.
  • Several candidates: inspect dates, original path and modification status.
  • Missing-line markers: retain the original and compare gaps against the intended work.
  • ATTENTION warning: inspect another live editing session as well as crash recovery.
  • Questionable markers: compare recovery problems/missing sections with source.
  • Renamed SWP is not readable text: use Vim recovery.

Vim SWP → separately saved recovered text

  1. Preserve originals and recover trusted swap data through Vim.
  2. Write separately, compare changes/gaps and adopt only verified content.
  3. Save recovered text separately and validate differences/missing content before adopting it.

Recovery is not guaranteed; do not load untrusted swap data merely to inspect it, and distinguish other SWP uses.

Active editing versus crash residue

Warnings can identify source, user, host and process; avoid simultaneous editing while another session remains active.

For crash recovery keep source/swap together and save the result separately rather than deleting it merely to dismiss warnings.

Source for these steps:Vim · recover.txt — Recovery after a crash / Vim · editing.txt — backup files

Verify recovery by comparison

Recovery may be incomplete; compare source, intended edits, line counts and problem markers.

Reopen the verified saved file before deciding candidate retention and keep recovery notes for diagnosis.

Source for these steps:Vim · recover.txt — Recovery after a crash / Vim · editing.txt — backup files

Related-format differences

Related-format differences
FormatMain roleWhat to check
SWPEditing/recovery stateIdentify producer/live session
BAKSaved backupCoverage can differ from unsaved edits
Source textNormal editable fileCompare with recovery

Handling and security

Vim documents swap recovery as intended for trusted data; avoid experimental recovery of unknown files.

Questions and answers

Is SWP the original text?

It uses recovery structures rather than ordinary plain text.

Should I delete it when warned?

Check active editing and unsaved changes first.

Overwrite immediately after recovery?

Save separately and compare for missing content.

Does deleting SWP resolve the issue?

You may lose unsaved work; identify active editing and recovery needs first.

Is every SWP a Vim swap?

Identify the producer rather than assuming every SWP belongs to Vim.

Format facts: name, steward and MIME type
Formal name
Vim swap file; other application uses possible
Steward / specification
Vim / producer-dependent
MIME type
Depends on the producer or server; an extension alone does not establish a MIME type.

Primary and official sources