Save all text to swap file
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Save all text to swap file.
Fixture files
- notes.txt
draft- .notes.txt.swp
exists; text blocks not fully flushed
Command entered · ready to apply
Fixture files
- notes.txt
draft- .notes.txt.swp
exists; text blocks not fully flushed
Writes all current buffer text to its swap file. The original notes.txt remains draft; preserve is not a normal file write.
Fixture files
- notes.txt
draft- .notes.txt.swp
all current text saved: draft revised; recoverable without original file
Before & after
Before
Fixture files
- notes.txt
draft- .notes.txt.swp
exists; text blocks not fully flushed
After
Fixture files
- notes.txt
draft- .notes.txt.swp
all current text saved: draft revised; recoverable without original file
Subject: :preserve. Documentation-backed illustration; assumes swapfile enabled, writable swap file for named notes.txt and modified current buffer; not replay-verified. Writes all current buffer text to its swap file. The original notes.txt remains draft; preserve is not a normal file write.
draft revisedCursor on line 1, column 1Details & Vim help
Save all text to swap file. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :pre[serve] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.