diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/vi.c b/editors/vi.c index ccf2870..47b13b3 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2816,6 +2816,13 @@ static void colon(char *buf) // is there a file name to write to? if (args[0]) { + struct stat statbuf; + + if (!useforce && (fn == NULL || strcmp(fn, args) != 0) && + stat(args, &statbuf) == 0) { + status_line_bold("File exists (:w! overrides)"); + goto ret; + } fn = args; } # if ENABLE_FEATURE_VI_READONLY |