[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] vi: add 'ZQ' quitting command
From:       Grob Grobmann <grobgrobmann () gmail ! com>
Date:       2022-06-08 19:51:54
Message-ID: CAKuP9fVbWmRM_D4zL38Z=azFVBdwJhUGE9tAiQN1wtr76vdZRg () mail ! gmail ! com
[Download RAW message or body]

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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic