From 0d0d636e727694e19b7cc271ac1b9b29c03c902d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 27 Apr 2006 18:52:50 +0000 Subject: [PATCH] in nano.texi, add a "Nanorc Files" section to explain the nanorc file format in detail, using text from nanorc.5 git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 + doc/man/nanorc.5 | 31 +++-- doc/nanorc.sample | 2 +- doc/texinfo/nano.texi | 259 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 265 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8ba6ec4..2d0463ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -176,6 +176,8 @@ CVS code - restricted mode, as rnano.1 does. (DLR) - Add minor updates to put some text back in sync with nano's help text, and with nano's current feature set. (DLR) + - Add a "Nanorc Files" section to explain the nanorc file format + in detail, using text from nanorc.5. (DLR) - doc/man/fr/nano.1, doc/man/fr/nanorc.5, doc/man/fr/rnano.1: - Updated manpage translations by Jean-Philippe Guérard. - doc/nanorc.sample: diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5 index 92c411ab..58ac3c61 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -31,17 +31,16 @@ The configuration file accepts a series of \fBset\fP and \fBunset\fP commands, which can be used to configure nano on startup without using the command line options. Additionally, the \fBsyntax\fP, \fBcolor\fP, and \fBicolor\fP keywords are used to define syntax highlighting rules -for different text patterns. GNU nano will read one command per line. +for different text patterns. \fBnano\fP will read one command per line. -Options in rcfiles take precedence over nano's defaults, and command -line options override rcfile settings. - -Options are unset by default, except for options that take an argument. +Options in nanorc files take precedence over nano's defaults, and +command line options override nanorc settings. Also, options are unset +by default, except for those that take arguments. Quotes inside string parameters don't have to be escaped with backslashes. The last double quote in the string will be treated as its -end. For example, for the brackets option, "\fI"')>]}\fP" will match -\fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP. +end. For example, for the \fBbrackets\fP option, "\fI"')>]}\fP" will +match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP. The supported commands and arguments are: @@ -120,8 +119,8 @@ Don't wrap text at all. .B set operatingdir "\fIdirectory\fP" \fBnano\fP will only read and write files inside \fIdirectory\fP and its subdirectories. Also, the current directory is changed to here, so -files are inserted from this dir. By default the operating directory -feature is turned off. +files are inserted from this diractory. By default, the operating +directory feature is turned off. .TP .B set/unset preserve Preserve the XON and XOFF keys (^Q and ^S). @@ -166,12 +165,12 @@ line. .B set/unset smooth Use smooth scrolling by default. .TP -.B set speller \fIspellprog\fP +.B set speller "\fIspellprog\fP" Use spelling checker \fIspellprog\fP instead of the built-in one, which calls \fIspell\fP. .TP .B set/unset suspend -Allow nano to be suspended. +Allow \fBnano\fP to be suspended. .TP .B set tabsize \fIn\fP Use a tab size of \fIn\fP columns. The value of \fIn\fP must be greater @@ -195,11 +194,11 @@ Detect word boundaries more accurately by treating punctuation characters as part of a word. .TP .B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ] -Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP -flag, or will be automatically activated if the current filename matches -the extended regular expression \fIfileregex\fP. All following -\fBcolor\fP and \fBicolor\fP statements will apply to \fIsyntax\fP until -a new syntax is defined. +Defines a syntax named \fIstr\fP which can be activated via the +-Y/--syntax command line option, or will be automatically activated if +the current filename matches the extended regular expression +\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements +will apply to \fIsyntax\fP until a new syntax is defined. The \fInone\fP syntax is reserved; specifying it on the command line is the same as not having a syntax at all. The \fIdefault\fP syntax is diff --git a/doc/nanorc.sample b/doc/nanorc.sample index 87c7ca06..4ef2337a 100644 --- a/doc/nanorc.sample +++ b/doc/nanorc.sample @@ -12,7 +12,7 @@ ## ## Quotes inside string parameters don't have to be escaped with ## backslashes. The last double quote in the string will be treated as -## its end. For example, for the brackets option, ""')>]}" will match +## its end. For example, for the "brackets" option, ""')>]}" will match ## ", ', ), >, ], and }. ## Use auto-indentation. diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi index c4d95cfb..15350ece 100644 --- a/doc/texinfo/nano.texi +++ b/doc/texinfo/nano.texi @@ -53,6 +53,7 @@ editor. * Editor Basics:: * Online Help:: * Feature Toggles:: +* Nanorc Files:: * The File Browser:: * Pico Compatibility:: * Building and Configure Options:: @@ -136,7 +137,7 @@ Don't add newlines to the ends of files. Don't convert files from DOS/Mac format. @item -Q [str], --quotestr [str] -Set the quoting string for justifying. The default is +Set the quoting string for justifying. The default value is @quotation @code{^([ \t]*[|>:@}#])+} @@ -172,7 +173,7 @@ characters as part of a word. @item -Y, --syntax=[str] Specify a specific syntax highlighting from the nanorc to use, if -available. +available. See @xref{Nanorc Files}, for more info. @item -c, --const Constantly display the cursor position and line number on the statusbar. @@ -334,13 +335,13 @@ editor and available keystrokes. Navigation is via the ^Y (Page Up) and ^V (Page Down) keys. ^X exits the help system. -@node Feature Toggles, The File Browser, Online Help, Top +@node Feature Toggles, Nanorc Files, Online Help, Top @chapter Feature Toggles Toggles allow you to change certain aspects of the editor that would normally be done via command line options. They are invoked via -certain Meta key sequences. See @xref{Special Functions}, for more info. -The following global toggles are available: +certain Meta key sequences. See @xref{Special Functions}, for more +info. The following global toggles are available: @table @code @@ -376,7 +377,7 @@ toggles the -O (@code{--morespace}) command line option. @item Whitespace Display Toggle (Meta-P) toggles whitespace display mode if you have a "whitespace" option in -your nanorc. +your nanorc. See @xref{Nanorc Files}, for more info. @item Tabs to Spaces Toggle (Meta-Q) toggles the -E (@code{--tabstospaces}) command line option. @@ -389,7 +390,7 @@ toggles the -x (@code{--nohelp}) command line option. @item Color Syntax Highlighting Toggle (Meta-Y) toggles color syntax highlighting if you have color syntaxes in your -nanorc. +nanorc. See @xref{Nanorc Files}, for more info. @item Suspend Toggle (Meta-Z) toggles the -z (@code{--suspend}) command line option. @@ -397,7 +398,241 @@ toggles the -z (@code{--suspend}) command line option. @end table -@node The File Browser, Pico Compatibility, Feature Toggles, Top +@node Nanorc Files, The File Browser, Feature Toggles, Top +@chapter Nanorc Files + +The nanorc files contain the default settings for @code{nano}. They +should not be in DOS or Mac format. During startup, @code{nano} will +first read its system-wide settings from SYSCONFDIR/nanorc, and then +user-specific settings from ~/.nanorc. + +A nanorc file accepts a series of "set" and "unset" commands, which can +be used to configure @code{nano} on startup without using the command +line options. Additionally, the "syntax", "color", and "icolor" +keywords are used to define syntax highlighting rules for different text +patterns. @code{nano} will read one command per line. + +Options in nanorc files take precedence over @code{nano}'s defaults, and +command line options override nanorc settings. Options are also unset +by default, except for those that take arguments. + +Quotes inside string parameters don't have to be escaped with +backslashes. The last double quote in the string will be treated as its +end. For example, for the "brackets" option, + +@quotation +@code{""')>]@}"} +@end quotation + +will match @code{"}, @code{'}, @code{)}, @code{>}, @code{]}, and +@code{@}}. + +The supported commands and arguments are: + +@table @code + +@item set/unset autoindent +Use auto-indentation. + +@item set/unset backup +Create backup files in "filename~". + +@item set backupdir "directory" +Set the directory where @code{nano} puts unique backup files if file +backups are enabled. + +@item set/unset backwards +Do backwards searches by default. + +@item set/unset boldtext +Use bold text instead of reverse video text. + +@item set brackets "string" +Set the characters treated as closing brackets. They cannot contain +blank characters. Only closing punctuation, optionally followed by +closing brackets, can end sentences. The default value is + +@quotation +@code{""')>]@}"} +@end quotation + +@item set/unset casesensitive +Do case sensitive searches by default. + +@item set/unset const +Constantly display the cursor position in the status bar. + +@item set/unset cut +Use cut to end of line by default. + +@item set fill "n" +Wrap lines at column number "n". If "n" is 0 or less, the maximum line +length will be the screen width less "n" columns. The default value is +-8. + +@item set/unset historylog +Enable ~/.nano_history for saving and reading search/replace strings. + +@item set matchbrackets "string" +Set the opening and closing brackets that can be found by bracket +searches. They cannot contain blank characters. The former set must +come before the latter set, and both must be in the same order. The +default value is + +@quotation +@code{"(<[@{)>]@}"} +@end quotation + +@item set/unset morespace +Allow use of the blank line below the titlebar as extra editing space. + +@item set/unset mouse +Enable mouse support, so that mouse clicks can be used to set the mark +and run shortcuts. + +@item set/unset multibuffer +Allow inserting files into their own buffers. + +@item set/unset noconvert +Don't convert files from DOS/Mac format. + +@item set/unset nofollow +Don't follow symlinks when writing files. + +@item set/unset nohelp +Don't display the help lists at the bottom of the screen. + +@item set/unset nonewlines +Don't add newlines to the ends of files. + +@item set/unset nowrap +Don't wrap text at all. + +@item set operatingdir "directory" +@code{nano} will only read and write files inside "directory" and its +subdirectories. Also, the current directory is changed to here, so +files are inserted from this diractory. By default, the operating +directory feature is turned off. + +@item set/unset preserve +Preserve the XON and XOFF keys (^Q and ^S). + +@item set punct "string" +Set the characters treated as closing punctuation. They cannot contain +blank characters. Only closing punctuation, optionally followed by +closing brackets, can end sentences. The default value is @code{"!.?"}. + +@item set/unset quickblank +Do quick statusbar blanking. Statusbar messages will disappear after 1 +keystroke instead of 25. + +@item set quotestr "string" +The email-quote string, used to justify email-quoted paragraphs. This +is an extended regular expression if your system supports them, +otherwise a literal string. The default value is + +@quotation +@code{"^([ \\t]*[#:>\\|@}])+"} +@end quotation + +if you have extended regular expression support, or "> " otherwise. +Note that '\\t' stands for a literal Tab character. + +@item set/unset rebinddelete +Interpret the Delete key differently so that both Backspace and Delete +work properly. You should only need to use this option if Backspace +acts like Delete on your system. + +@item set/unset rebindkeypad +Interpret the numeric keypad keys so that they all work properly. You +should only need to use this option if they don't, as mouse support +won't work properly with this option enabled. + +@item set/unset regexp +Do extended regular expression searches by default. + +@item set/unset smarthome +Make the Home key smarter. When Home is pressed anywhere but at the +very beginning of non-whitespace characters on a line, the cursor will +jump to that beginning (either forwards or backwards). If the cursor is +already at that position, it will jump to the true beginning of the +line. + +@item set/unset smooth +Use smooth scrolling by default. + +@item set speller "spellprog" +Use spelling checker "spellprog" instead of the built-in one, which +calls "spell". + +@item set/unset suspend +Allow @code{nano} to be suspended. + +@item set tabsize "n" +Use a tab size of "n" columns. The value of "n" must be greater than 0. +The default value is 8. + +@item set/unset tabstospaces +Convert typed tabs to spaces. + +@item set/unset tempfile +Save automatically on exit, don't prompt. + +@item set/unset view +Disallow file modification. + +@item set whitespace "string" +Set the two characters used to display the first characters of tabs and +spaces. They must be single-column characters. + +@item set/unset wordbounds +Detect word boundaries more accurately by treating punctuation +characters as part of a word. + +@item syntax "str" ["fileregex" ... ] +Defines a syntax named "str" which can be activated via the -Y/--syntax +command line option, or will be automatically activated if the current +filename matches the extended regular expression "fileregex". All +following "color" and "icolor" statements will apply to "syntax" until a +new syntax is defined. + +The "none" syntax is reserved; specifying it on the command line is the +same as not having a syntax at all. The "default" syntax is special: it +takes no "fileregex", and applies to files that don't match any other +syntax's "fileregex". + +@item color fgcolor,bgcolor "regex" ... +For the currently defined syntax, display all expressions matching the +extended regular expression "regex" with foreground color "fgcolor" and +background color "bgcolor", at least one of which must be specified. +Legal colors for foreground and background color are: white, black, red, +blue, green, yellow, magenta, and cyan. You may use the prefix "bright" +to force a stronger color highlight for the foreground. If your +terminal supports transparency, not specifying a "bgcolor" tells "nano" +to attempt to use a transparent background. + +@item icolor fgcolor,bgcolor "regex" ... +Same as above, except that the expression matching is case insensitive. + +@item color fgcolor,bgcolor start="sr" end="er" +Display expressions which start with the extended regular expression +"sr" and end with the extended regular expression "er" with foreground +color "fgcolor" and background color "bgcolor", at least one of which +must be specified. This allows syntax highlighting to span multiple +lines. Note that all subsequent instances of "sr" after an initial "sr" +is found will be highlighted until the first instance of "er". + +@item icolor fgcolor,bgcolor start="sr" end="er" +Same as above, except that the expression matching is case insensitive. + +@item include "syntaxfile" +Read in self-contained color syntaxes from "syntaxfile". Note that +"syntaxfile" can only contain "syntax", "color", and "icolor" commands. + +@end table + + +@node The File Browser, Pico Compatibility, Nanorc Files, Top @chapter The File Browser When reading or writing files, pressing ^T will invoke the file browser. @@ -526,9 +761,8 @@ Enable extra features. At the moment, this is just easter egg-type stuff. @item --enable-color -Enable support for syntax coloring of files. See the nanorc -documentation for more details. The nanorc feature will also be -enabled. +Enable support for syntax coloring of files using the nanorc file. This +enables nanorc support as well. @item --enable-multibuffer Enable support for opening multiple files at a time and switching @@ -537,7 +771,8 @@ between them on the fly. @item --enable-nanorc Enable support for reading the nanorc file at startup. You can store custom settings in the nanorc file rather than having to pass command -line options to get desired behavior. +line options to get desired behavior. See @xref{Nanorc Files}, for +more info. @item --enable-all Shortcut for enabling the above four features (extra, color,