Vim Recall繁體中文

Switch to a newly saved path

:saveas draft-v2.txt

Example

Normal mode. The existing file draft.txt is open with unsaved edits. draft-v2.txt does not exist.

Before
Current file: draft.txt Buffer: unsaved changes

  1. :saveas draft-v2.txt<CR> Save and continue in draft-v2.txt · old file stays on disk

After
Current file: draft-v2.txt Buffer: saved Old draft.txt: still on disk

Details & Vim help

Write the buffer to a new file and make that path its current name.

Continue editing a new version while retaining the old file.

This writes a file immediately. An existing destination needs an explicit overwrite decision. :write other.txt writes a copy but normally keeps the current buffer name.

:saveas writes the new file and changes the current buffer’s name.

Try it in Vim

  1. Run :saveas draft-v2.txt<CR>.
  2. Check :file to confirm the current buffer’s new path.
  3. Continue editing and use :write for later saves.