[PATCH] vi: add 'ZQ' quitting command
Denys Vlasenko
vda.linux at googlemail.com
Tue Aug 2 13:07:58 UTC 2022
Applied, thank you
On Wed, Jun 8, 2022 at 9:52 PM Grob Grobmann <grobgrobmann at gmail.com> wrote:
>
> 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 at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list