vis

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

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

commit 2c8e19cfde8b614bbddc50c390d1161678d21ff0
parent d4d472c51e1b51f4afeed664a2b8a4f8b7c57992
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  4 Mar 2017 18:30:29 +0100

vis: process command line options when reading from stdin

Previously the following had no effect:

 $ echo foo | vis +"set syntax markdown" -

Fix #512

Diffstat:
Mmain.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c @@ -2173,17 +2173,18 @@ int main(int argc, char *argv[]) { close(fd); } else if (strcmp(argv[i], "--") == 0) { end_of_options = true; + continue; } } else if (argv[i][0] == '+' && !end_of_options) { cmd = argv[i] + (argv[i][1] == '/' || argv[i][1] == '?'); + continue; } else if (!vis_window_new(vis, argv[i])) { vis_die(vis, "Can not load `%s': %s\n", argv[i], strerror(errno)); - } else { - win_created = true; - if (cmd) { - vis_prompt_cmd(vis, cmd); - cmd = NULL; - } + } + win_created = true; + if (cmd) { + vis_prompt_cmd(vis, cmd); + cmd = NULL; } }