fix(cmd): :update does not write new, unmodified buffer #35929

Problem: update command does not write new buffers that have
filenames but no corresponding file on disk, even when using ++p flag.

Solution: allow update to write when buffer has filename but file
doesn't exist.
This commit is contained in:
glepnir
2025-09-28 01:24:24 +08:00
committed by GitHub
parent 2aab242a01
commit 69cae6259e
2 changed files with 96 additions and 1 deletions

View File

@@ -1772,7 +1772,7 @@ void ex_file(exarg_T *eap)
/// ":update".
void ex_update(exarg_T *eap)
{
if (curbufIsChanged()) {
if (curbufIsChanged() || (curbuf->b_ffname != NULL && !os_path_exists(curbuf->b_ffname))) {
do_write(eap);
}
}