[PATCH] vi: add 'ZQ' quitting command
Grob Grobmann
grobgrobmann at gmail.com
Wed Jun 8 19:51:54 UTC 2022
Busybox vi provides the 'ZZ' command to save and close
the similar 'ZQ' command just exits without saving
I propose this small patch to add that command.
diff --git a/editors/vi.c b/editors/vi.c
index 3dbe5b471..2357caa5d 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -4290,8 +4290,14 @@ static void do_cmd(int c)
goto dc_i; // start inserting
break;
case 'Z': // Z- if modified, {write}; exit
- // ZZ means to save file (if necessary), then exit
c1 = get_one_char();
+ // ZQ means to exit without saving
+ if (c1 == 'Q') {
+ editing=0;
+ optind = cmdline_filecnt;
+ break;
+ }
+ // ZZ means to save file (if necessary), then exit
if (c1 != 'Z') {
indicate_error();
break;
Cheers
More information about the busybox
mailing list