Both :file
and :saveas
seem to change the name of the buffer without writing. What's the difference between them? Also, in scratch buffers, :saveas
seems to cause an error while :file
does not. I included the relevant help sections below, but need some help making sense of them.
CTRL-G or *CTRL-G* *:f* *:fi* *:file*
*:file_f*
:f[ile][!] {name} Sets the current file name to {name}. The optional !
avoids truncating the message, as with |:file|.
If the buffer did have a name, that name becomes the
|alternate-file| name. An unlisted buffer is created
to hold the old name.
:sav[eas][!] [++opt] {file}
Save the current buffer under the name {file} and set
the filename of the current buffer to {file}. The
previous name is used for the alternate file name.
The [!] is needed to overwrite an existing file.
When 'filetype' is empty filetype detection is done
with the new name, before the file is written.
When the write was successful 'readonly' is reset.
{not in Vi}