vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit af62195ff0b04b578ab5583c3a9aca33b10b47b5
parent 7d1db13a6cee02b54f1b2d700d72fda713e2ba24
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu,  2 Mar 2017 12:10:59 +0100

vis: remove :bdelete command

It does not really fit into the style of the rest of
the command language. Eventually we should be able
to express this kind of thing using a looping construct
based on the `X` and `Y` commands.

Diffstat:
Mman/vis.1 | 2--
Msam.c | 4----
Mvis-cmds.c | 18------------------
3 files changed, 0 insertions(+), 24 deletions(-)

diff --git a/man/vis.1 b/man/vis.1 @@ -976,8 +976,6 @@ open a new window, displaying file name if given split window horizontally .It Cm :vsplit Bq file name split window vertically -.It Cm :bdelete[!] -close all windows which display the same file as the current one .It Cm :q[!] close currently focused window .It Cm :qall[!] diff --git a/sam.c b/sam.c @@ -122,7 +122,6 @@ static bool cmd_cd(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange* /* vi(m) commands */ static bool cmd_set(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); static bool cmd_open(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); -static bool cmd_bdelete(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); static bool cmd_qall(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); static bool cmd_split(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); static bool cmd_vsplit(Vis*, Win*, Command*, const char *argv[], Cursor*, Filerange*); @@ -211,9 +210,6 @@ static const CommandDef cmds[] = { }, /* vi(m) related commands */ { - "bdelete", VIS_HELP("Unload file") - CMD_FORCE|CMD_ONCE|CMD_ADDRESS_NONE|CMD_DESTRUCTIVE, NULL, cmd_bdelete - }, { "help", VIS_HELP("Show this help") CMD_ARGV|CMD_ONCE|CMD_ADDRESS_NONE, NULL, cmd_help }, { diff --git a/vis-cmds.c b/vis-cmds.c @@ -447,24 +447,6 @@ static bool cmd_quit(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso return true; } -static bool cmd_bdelete(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) { - if (!win) - return false; - Text *txt = win->file->text; - if (text_modified(txt) && cmd->flags != '!') { - info_unsaved_changes(vis); - return false; - } - for (Win *next, *win = vis->windows; win; win = next) { - next = win->next; - if (win->file->text == txt) - vis_window_close(win); - } - if (!has_windows(vis)) - vis_exit(vis, EXIT_SUCCESS); - return true; -} - static bool cmd_qall(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) { for (Win *next, *win = vis->windows; win; win = next) { next = win->next;