vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit d3d92a4fdede8ce24a3d55896f8a505f535afa0e parent 3bb0c003c48b50a13b7c20a9de6f7a436860f27d Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 23 Feb 2020 12:09:43 +0100 sam: warn when attempting to write to an existing file Add ! to override. Diffstat:
| M | sam.c | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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 != '!') {