aboutsummaryrefslogtreecommitdiff
path: root/sam.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-02-23 12:09:43 +0100
committerMarc André Tanner <mat@brain-dump.org>2020-02-23 12:09:43 +0100
commitf7f7009cdbfec8e79b90296e3de74e3b697916e8 (patch)
treee9804c6cae69c3c8609196e3799aa0f88d13ff81 /sam.c
parent9d789adf02d80001bbd2f2af7f48526e08ccffe8 (diff)
downloadvis-f7f7009cdbfec8e79b90296e3de74e3b697916e8.tar.gz
vis-f7f7009cdbfec8e79b90296e3de74e3b697916e8.tar.xz
sam: warn when attempting to write to an existing file
Add ! to override.
Diffstat (limited to 'sam.c')
-rw-r--r--sam.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sam.c b/sam.c
index 2816403..1903d3f 100644
--- a/sam.c
+++ b/sam.c
@@ -1656,6 +1656,10 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Sele
vis_info_show(vis, "WARNING: file has been changed since reading it");
goto err;
}
+ if (existing_file && !same_file) {
+ vis_info_show(vis, "WARNING: file exists");
+ goto err;
+ }
}
if (!vis_event_emit(vis, VIS_EVENT_FILE_SAVE_PRE, file, path) && cmd->flags != '!') {