From d0c2c1e6b99645038753716e8ef5ec0e45054f7b 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 Suggest in the documentation how to get a one-keystroke Suspend. --- doc/nano.1 | 4 +++- doc/nano.texi | 8 ++++++-- doc/nanorc.5 | 4 +++- doc/sample.nanorc.in | 6 +++--- src/global.c | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/nano.1 b/doc/nano.1 index f3568a6c..b68b7890 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, +reachable via \fB^T^Z\fR. (If you want a plain \fB^Z\fR to +suspend nano, add \fBbind ^Z suspend main\fR to 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..d734237a 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, +reachable via @kbd{^T^Z}. (If you want a plain @kbd{^Z} to +suspend nano, add @code{bind ^Z suspend main} to your nanorc.) @item -% @itemx --stateflags @@ -1093,7 +1095,9 @@ 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, +reachable via @kbd{^T^Z}. (If you want a plain @kbd{^Z} to +suspend nano, add @code{bind ^Z suspend main} to 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..d4159cf6 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -339,7 +339,9 @@ 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, +reachable via \fB^T^Z\fR. (If you want a plain \fB^Z\fR to +suspend nano, add \fBbind ^Z suspend main\fR to 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. */