Vim Recall繁體中文

Show the name of the current swap file

:swapname

Example

Normal 0 / 2

Show the name of the current swap file.

Buffer

File
/demo/notes.txt
swapfile
on

Vim messages

Empty
Before & after

Before

Buffer

File
/demo/notes.txt
swapfile
on

Vim messages

Empty

After

Buffer

File
/demo/notes.txt
swapfile
on

Vim messages

/demo/.notes.txt.swp

Subject: :swapname. Documentation-backed illustration; assumes swapfile enabled and this named file has exactly the displayed swap path; not replay-verified. Displays this buffer's swap-file path; it neither flushes the text nor recovers a file.

Sample buffer
notes
Cursor on line 1, column 1
Details & Vim help

Show the name of the current 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 :sw[apname] 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.