diff options
author | Louis Sven Goulet <31444858+lorlouis@users.noreply.github.com> | 2022-09-24 21:57:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-24 18:57:10 -0700 |
commit | 2a3cb0893b03aeff4d8c0b2116cbddda53bba5a2 (patch) | |
tree | e108192c095f418f5f2255468e3a4d570119eb00 /src/nvim/fileio.c | |
parent | c7cf1232a71b0db700b818e2ae8e8ebaf40133f2 (diff) | |
download | rneovim-2a3cb0893b03aeff4d8c0b2116cbddda53bba5a2.tar.gz rneovim-2a3cb0893b03aeff4d8c0b2116cbddda53bba5a2.tar.bz2 rneovim-2a3cb0893b03aeff4d8c0b2116cbddda53bba5a2.zip |
feat: ":write!" skips "file changed" warning #18665
Problem:
Cannot opt-out of "WARNING: The file has been changed since reading
it!!!", even with ":write!".
Solution:
Change ":write!" to skip the warning.
closes #7270
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index d391e19964..76317298dc 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2536,8 +2536,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en goto fail; } - // Check if the timestamp hasn't changed since reading the file. - if (overwriting) { + // If 'forceit' is false, check if the timestamp hasn't changed since reading the file. + if (overwriting && !forceit) { retval = check_mtime(buf, &file_info_old); if (retval == FAIL) { goto fail; |