diff --git a/doc/faq.html b/doc/faq.html index 3e8a9dbd..bf32fbd4 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -5,7 +5,7 @@ The GNU nano editor FAQ - diff --git a/doc/nano.1 b/doc/nano.1 index 1eb19c5f..8fc40dff 100644 --- a/doc/nano.1 +++ b/doc/nano.1 @@ -112,6 +112,7 @@ nanorc file. See \fBnanorc\fR(5). .BR \-E ", " \-\-tabstospaces Convert each typed tab to spaces -- to the number of spaces that a tab at that position would take up. +(Note: pasted tabs are not converted.) .TP .BR \-F ", " \-\-multibuffer Read a file into a new buffer by default. @@ -391,6 +392,9 @@ 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.) .sp +When you want to copy marked text from \fBnano\fR to the system's clipboard, +see one of the examples in the \fBnanorc\fR(5) man page. +.sp If no alternative spell checker command is specified on the command line nor in one of the \fInanorc\fP files, \fBnano\fP will check the \fBSPELL\fP environment variable for one. @@ -404,6 +408,9 @@ that name already exists in the current directory, it will add ".save" plus a number (e.g.\& ".save.1") to the current filename in order to make it unique. In multibuffer mode, \fBnano\fP will write all the open buffers to their respective emergency files. +.sp +If you have any question about how to use \fBnano\fR in some specific +situation, you can ask on \fIhelp-nano@gnu.org\fR. .SH BUGS The recording and playback of keyboard macros works correctly only on a diff --git a/doc/nano.texi b/doc/nano.texi index 007712c2..8aca07b4 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -123,6 +123,9 @@ following options: @option{--breaklonglines}, @blankline Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}. +@blankline +Questions about using nano you can ask at @email{help-nano@@gnu.org}. + @blankline For background information see @url{https://nano-editor.org/}. @@ -406,6 +409,7 @@ nanorc file. @xref{@code{set keycolor}} for details. @itemx --tabstospaces Convert each typed tab to spaces --- to the number of spaces that a tab at that position would take up. +(Note: pasted tabs are not converted.) @item -F @itemx --multibuffer @@ -1140,6 +1144,7 @@ greater than 0. The default value is @t{8}. @item set tabstospaces Convert each typed tab to spaces --- to the number of spaces that a tab at that position would take up. +(Note: pasted tabs are not converted.) @item set titlecolor [bold,][italic,]@var{fgcolor},@var{bgcolor} Use this color combination for the title bar. @@ -1230,9 +1235,10 @@ will be added to this syntax, until a new @code{syntax} command is encountered. When @command{nano} is run, this syntax will be automatically -activated if the current filename matches the extended regular -expression @var{fileregex}. Or the syntax can be explicitly -activated by using the @option{-Y} or @option{--syntax} +activated (for the relevant buffer) if the absolute filename +matches the extended regular expression @var{fileregex}. +Or the syntax can be explicitly activated (for all buffers) +by using the @option{-Y} or @option{--syntax} command-line option followed by the @var{name}. The @code{default} syntax is special: it takes no @var{fileregex}, diff --git a/doc/nanorc.5 b/doc/nanorc.5 index 0786069c..84db959d 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -335,6 +335,7 @@ greater than 0. The default value is \fB8\fR. .B set tabstospaces Convert each typed tab to spaces -- to the number of spaces that a tab at that position would take up. +(Note: pasted tabs are not converted.) .TP .B set titlecolor \fR[\fBbold,\fR][\fBitalic,\fR]\fIfgcolor\fB,\fIbgcolor\fR Use this color combination for the title bar. @@ -398,12 +399,6 @@ and disappears after 1.5 seconds or upon the next keystroke. With \fBM\-Z\fR the title bar plus status bar can be toggled. With \fBM\-X\fR the help lines. -.SH NOTES -Option \fBset suspendable\fR has been removed. -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.) - .SH SYNTAX HIGHLIGHTING Coloring the different syntactic elements of a file is done via regular expressions (see the \fBcolor\fR command below). @@ -444,9 +439,10 @@ will be added to this syntax, until a new \fBsyntax\fR command is encountered. .sp When \fBnano\fR is run, this syntax will be automatically -activated if the current filename matches the extended regular -expression \fIfileregex\fR. Or the syntax can be explicitly -activated by using the \fB\-Y\fR or \fB\-\-syntax\fR +activated (for the relevant buffer) if the absolute filename +matches the extended regular expression \fIfileregex\fR. +Or the syntax can be explicitly activated (for all buffers) +by using the \fB\-Y\fR or \fB\-\-syntax\fR command-line option followed by the \fIname\fR. .sp The syntax \fBdefault\fP is special: it takes no \fIfileregex\fR, @@ -1038,6 +1034,20 @@ For \fBbind\fR it means all menus where the specified \fIfunction\fR exists; for \fBunbind\fR it means all menus where the specified \fIkey\fR exists. .RE +.SH EXAMPLES +To make \fBCtrl+Z\fR suspend nano: +.sp +.RS +.B bind ^Z suspend main +.RE +.sp +To make \fBShift+Alt+C\fR copy the marked region to the system's clipboard: +.sp +.RS +.B bind Sh-M-C """{execute}| xsel -ib {enter}{undo}""" main +.RE +.sp + .SH FILES .TP .I /etc/nanorc diff --git a/src/global.c b/src/global.c index bc7bdd83..e7217a02 100644 --- a/src/global.c +++ b/src/global.c @@ -1417,7 +1417,7 @@ void shortcut_init(void) add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0); add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0); - add_to_sclist(MWHEREIS|MGOTOLINE, "^/", 0, flip_goto, 0); + add_to_sclist(MWHEREIS|MGOTOLINE, SLASH_OR_DASH, 0, flip_goto, 0); #ifdef ENABLE_HISTORIES add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_older_item, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_newer_item, 0); diff --git a/src/help.c b/src/help.c index 56411612..f2e1962c 100644 --- a/src/help.c +++ b/src/help.c @@ -50,7 +50,7 @@ void help_init(void) char *ptr; /* First, set up the initial help text for the current function. */ - if (currmenu & (MWHEREIS|MREPLACE|MREPLACEWITH)) { + if (currmenu & (MWHEREIS|MREPLACE)) { htx[0] = N_("Search Command Help Text\n\n " "Enter the words or characters you would like to " "search for, and then press Enter. If there is a " @@ -65,6 +65,13 @@ void help_init(void) "will be replaced.\n\n The following function keys are " "available in Search mode:\n\n"); htx[2] = NULL; + } else if (currmenu == MREPLACEWITH) { + htx[0] = N_("=== Replacement ===\n\n " + "Type the characters that should replace the characters that " + "you typed at the previous prompt, and press Enter.\n\n"); + htx[1] = N_(" The following function keys " + "are available at this prompt:\n\n"); + htx[2] = NULL; } else if (currmenu == MGOTOLINE) { htx[0] = N_("Go To Line Help Text\n\n " "Enter the line number that you wish to go to and hit " @@ -126,8 +133,8 @@ void help_init(void) "shown in brackets after the search prompt. Hitting " "Enter without entering any text will perform the " "previous search.\n\n"); - htx[1] = N_(" The following function keys are available in " - "Browser Search mode:\n\n"); + htx[1] = N_(" The following function keys " + "are available at this prompt:\n\n"); htx[2] = NULL; } else if (currmenu == MGOTODIR) { htx[0] = N_("Browser Go To Directory Help Text\n\n " @@ -167,8 +174,8 @@ void help_init(void) htx[1] = N_("If you just need another blank buffer, do not enter any " "command.\n\n You can also pick one of four tools, or cut a " "large piece of the buffer, or put the editor to sleep.\n\n"); - htx[2] = N_(" The following function keys are " - "available in Execute Command mode:\n\n"); + htx[2] = N_(" The following function keys " + "are available at this prompt:\n\n"); } else if (currmenu == MLINTER) { htx[0] = N_("=== Linter ===\n\n " "In this mode, the status bar shows an error message or " diff --git a/src/nano.c b/src/nano.c index 38648329..6a79260b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -310,7 +310,7 @@ void do_exit(void) /* When unmodified, simply close. Else, when doing automatic saving * and the file has a name, simply save. Otherwise, ask the user. */ - if (!openfile->modified) + if (!openfile->modified || ISSET(VIEW_MODE)) choice = NO; else if (ISSET(SAVE_ON_EXIT) && openfile->filename[0] != '\0') choice = YES; diff --git a/src/winio.c b/src/winio.c index 9d80a713..22c04a2a 100644 --- a/src/winio.c +++ b/src/winio.c @@ -399,7 +399,7 @@ void implant(const char *string) } /* Continue processing an expansion string. Returns either an error code, - * a plain keycode, or a placeholder for a command shortcut. */ + * a plain character byte, or a placeholder for a command shortcut. */ int get_code_from_plantation(void) { if (*plants_pointer == '{') { @@ -432,6 +432,7 @@ int get_code_from_plantation(void) return PLANTED_COMMAND; } else { char *opening = strchr(plants_pointer, '{'); + char firstbyte = *plants_pointer; int length; if (opening) { @@ -440,12 +441,12 @@ int get_code_from_plantation(void) } else length = strlen(plants_pointer); - for (int index = length - 1; index >= 0; index--) + for (int index = length - 1; index > 0; index--) put_back((unsigned char)plants_pointer[index]); plants_pointer += length; - return ERR; + return (firstbyte) ? firstbyte : ERR; } } #endif diff --git a/syntax/python.nanorc b/syntax/python.nanorc index e8ba17e2..51bc4691 100644 --- a/syntax/python.nanorc +++ b/syntax/python.nanorc @@ -24,6 +24,9 @@ color brightcyan "\<(exec|print)([[:blank:]]|$)" # Special values. color brightmagenta "\<(False|None|True)\>" +# Decorators. +color cyan "@[[:alpha:]_][[:alnum:]_.]*" + # Mono-quoted strings. color brightgreen "'([^'\]|\\.)*'|"([^"\]|\\.)*"|'''|"""" color normal "'''|""""