From f7f7009cdbfec8e79b90296e3de74e3b697916e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 23 Feb 2020 12:09:43 +0100 Subject: sam: warn when attempting to write to an existing file Add ! to override. --- sam.c | 4 ++++ 1 file changed, 4 insertions(+) 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 != '!') { -- cgit v1.2.3