From 91f07884b3b5d8b04f5afb1e088195ccf58f7a29 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 4 Nov 2021 10:05:56 +0100 Subject: [PATCH] suspension: leave ^Z unbound by default -- just ^T^Z will suspend nano And suggest in the documentation how get a one-keystroke Suspend. --- doc/nano.1 | 4 +++- doc/nano.texi | 9 +++++++-- doc/nanorc.5 | 5 ++++- doc/sample.nanorc.in | 6 +++--- src/global.c | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/nano.1 b/doc/nano.1 index f3568a6c..15a83f43 100644 --- a/doc/nano.1 +++ b/doc/nano.1 @@ -328,7 +328,9 @@ Don't show the two help lines at the bottom of the screen. Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. .TP .BR \-z ", " \-\-suspendable -Obsolete option. Ignored. Suspension is enabled by default. +Obsolete option. Ignored. Suspension is enabled by default, +available through \fB^T^Z\fR. (If you want to suspend nano with +a single keystroke, you can bind the function in your nanorc.) .TP .BR \-% ", " \-\-stateflags Use the top-right corner of the screen for showing some state flags: diff --git a/doc/nano.texi b/doc/nano.texi index 6feb95dc..4c9de1a7 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -671,7 +671,9 @@ instead of beginnings. @item -z @itemx --suspendable -Obsolete option. Ignored. Suspension is enabled by default. +Obsolete option. Ignored. Suspension is enabled by default, +available through @kbd{^T^Z}. (If you want to suspend nano with +a single keystroke, you can bind the function in your nanorc.) @item -% @itemx --stateflags @@ -1093,7 +1095,10 @@ Use this color combination for the vertical guiding stripe. @xref{@code{set keycolor}} for valid color names. @item set suspendable -Obsolete option. Ignored. Suspension is enabled by default. +Obsolete option. Ignored. Suspension is enabled by default, +available through @kbd{^T^Z}. (If you want to suspend nano with +a single keystroke, you can put @code{bind ^Z suspend main} in +your nanorc.) @item set tabsize @var{number} Use a tab size of @var{number} columns. The value of @var{number} must be diff --git a/doc/nanorc.5 b/doc/nanorc.5 index 245a0573..a6bb3b4e 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -339,7 +339,10 @@ Use this color combination for the vertical guiding stripe. See \fBset titlecolor\fR for more details. .TP .B set suspendable -Obsolete option. Ignored. Suspension is enabled by default. +Obsolete option. Ignored. Suspension is enabled by default, +available through \fB^T^Z\fR. (If you want to suspend nano with +a single keystroke, you can put \fBbind ^Z suspend main\fR in +your nanorc.) .TP .B set tabsize \fInumber\fR Use a tab size of \fInumber\fR columns. The value of \fInumber\fP must be diff --git a/doc/sample.nanorc.in b/doc/sample.nanorc.in index aa38d4fd..a1c59aa8 100644 --- a/doc/sample.nanorc.in +++ b/doc/sample.nanorc.in @@ -252,6 +252,9 @@ ## === Key bindings === ## For all details, see 'man nanorc', section REBINDING KEYS. +## If you want to suspend nano with one keystroke (instead of with ^T^Z): +# bind ^Z suspend main + ## The keystroke deletes the word to the right of the cursor. ## On some terminals the keystroke produces ^H, which is ## the ASCII character for backspace, so it is bound by default to the @@ -272,9 +275,6 @@ # unbind M-T main ## (Those functions are still accessible through ^T^J and ^T^V.) -## If you sometimes hit ^Z by accident (you can still suspend with ^T^Z): -# unbind ^Z main - ## For quickly uppercasing or lowercasing the word under the cursor. ## (These effectively do a Ctrl+Right followed by a Shift+Ctrl+Left, ## and then pipe the selected text through a sed command.) diff --git a/src/global.c b/src/global.c index a9a78e9c..61f1dbaf 100644 --- a/src/global.c +++ b/src/global.c @@ -1334,6 +1334,7 @@ void shortcut_init(void) #ifndef NANO_TINY add_to_sclist(MMAIN, "M-T", 0, cut_till_eof, 0); add_to_sclist(MEXECUTE, "^V", 0, cut_till_eof, 0); + add_to_sclist(MEXECUTE, "^Z", 0, do_suspend_void, 0); add_to_sclist(MMAIN, "M-D", 0, count_lines_words_and_characters, 0); #else add_to_sclist(MMAIN, "M-H", 0, do_help, 0); @@ -1349,7 +1350,6 @@ void shortcut_init(void) add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "^L", 0, full_refresh, 0); else add_to_sclist(MMOST|MBROWSER|MYESNO, "^L", 0, full_refresh, 0); - add_to_sclist(MMAIN|MEXECUTE, "^Z", 0, do_suspend_void, 0); #ifndef NANO_TINY /* Group of "Appearance" toggles. */ -- 2.29.3