docs: reword the explanation of the 'syntax' command
parent
6d121cc81f
commit
f4c3670f64
|
@ -934,26 +934,30 @@ via the following commands in a nanorc file:
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@item syntax "@var{name}" ["@var{fileregex}" @dots{}]
|
@item syntax "@var{name}" ["@var{fileregex}" @dots{}]
|
||||||
Defines a syntax named "name" which can be activated via the @option{-Y}
|
Start the definition of a syntax with this @var{name}.
|
||||||
or @option{--syntax}
|
All subsequent @code{color} and other such commands
|
||||||
command-line option, or will be automatically activated if the current
|
will be added to this syntax, until a new @code{syntax}
|
||||||
filename matches the extended regular expression "fileregex". All
|
|
||||||
subsequent @code{color}, @code{icolor}, @code{header} and other such
|
|
||||||
statements will apply to this "name" syntax until a new @code{syntax}
|
|
||||||
command is encountered.
|
command is encountered.
|
||||||
|
|
||||||
The "none" syntax is reserved; specifying it on the command line is the
|
When @command{nano} is run, this syntax will be automatically
|
||||||
same as not having a syntax at all. The "default" syntax is special: it
|
activated if the current filename matches the extended regular
|
||||||
takes no "fileregex", and applies to files that don't match any
|
expression @var{fileregex}. Or the syntax can be explicitly
|
||||||
syntax's "fileregex".
|
activated 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},
|
||||||
|
and applies to files that don't match any syntax's @var{fileregex}.
|
||||||
|
The @code{none} syntax is reserved; specifying it on the
|
||||||
|
command line is the same as not having a syntax at all.
|
||||||
|
|
||||||
@item linter @var{program} [@var{arg} @dots{}]
|
@item linter @var{program} [@var{arg} @dots{}]
|
||||||
Use the given program to do a syntax check on the current file
|
Use the given @var{program} to do a syntax check on the current file.
|
||||||
(this overrides the speller function when defined).
|
(This overrides the speller function.)
|
||||||
|
|
||||||
@item formatter @var{program} [@var{arg} @dots{}]
|
@item formatter @var{program} [@var{arg} @dots{}]
|
||||||
Use the given program to automatically reformat text.
|
Use the given @var{program} to automatically reformat text ---
|
||||||
Useful in certain programming languages (e.g.@: Go).
|
useful for a programming language like Go.
|
||||||
|
(This overrides the speller and linter functions.)
|
||||||
|
|
||||||
@item header "@var{regex}" @dots{}
|
@item header "@var{regex}" @dots{}
|
||||||
Add one or more regexes which will
|
Add one or more regexes which will
|
||||||
|
@ -1007,12 +1011,13 @@ Read in self-contained color syntaxes from "syntaxfile". Note that
|
||||||
"syntaxfile" may contain only the above commands, from @code{syntax}
|
"syntaxfile" may contain only the above commands, from @code{syntax}
|
||||||
to @code{icolor}.
|
to @code{icolor}.
|
||||||
|
|
||||||
@item extendsyntax @var{name} @var{directive} [@var{arg} @dots{}]
|
@item extendsyntax @var{name} @var{command} [@var{arg} @dots{}]
|
||||||
Extend the syntax previously defined as "name" to include new information.
|
Extend the syntax previously defined as "@var{name}" with another @var{command}.
|
||||||
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
||||||
@code{magic}, @code{comment}, @code{linter}, or @code{formatter} directive to an already
|
@code{magic}, @code{comment}, @code{linter}, or @code{formatter} command
|
||||||
|
to an already
|
||||||
defined syntax --- useful when you want to slightly improve a syntax defined
|
defined syntax --- useful when you want to slightly improve a syntax defined
|
||||||
in one of the system-installed files (which are normally not writable).
|
in one of the system-installed files (which normally are not writable).
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
48
doc/nanorc.5
48
doc/nanorc.5
|
@ -70,7 +70,7 @@ the file's name.
|
||||||
.TP
|
.TP
|
||||||
.B set backupdir "\fIdirectory\fP"
|
.B set backupdir "\fIdirectory\fP"
|
||||||
Make and keep not just one backup file, but make and keep a uniquely
|
Make and keep not just one backup file, but make and keep a uniquely
|
||||||
numbered one every time a file is saved --- when backups are enabled
|
numbered one every time a file is saved -- when backups are enabled
|
||||||
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
|
with \fBset backup\fR or \fB\-\-backup\fR or \fB\-B\fR.
|
||||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||||
.TP
|
.TP
|
||||||
|
@ -294,30 +294,34 @@ powerful enough to fully parse a file. Nevertheless, regular
|
||||||
expressions can do a lot and are easy to make, so they are a
|
expressions can do a lot and are easy to make, so they are a
|
||||||
good fit for a small editor like \fBnano\fR.
|
good fit for a small editor like \fBnano\fR.
|
||||||
.sp
|
.sp
|
||||||
A separate syntax can be defined for each kind of file
|
For each kind of file a separate syntax can be defined
|
||||||
via the following commands:
|
via the following commands:
|
||||||
.TP
|
.TP
|
||||||
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
|
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
|
||||||
Defines a syntax named \fIname\fP which can be activated via the
|
Start the definition of a syntax with this \fIname\fR.
|
||||||
.BR \-Y / \-\-syntax
|
All subsequent \fBcolor\fR and other such commands
|
||||||
command-line option, or will be automatically activated if
|
will be added to this syntax, until a new \fBsyntax\fR
|
||||||
the current filename matches the extended regular expression
|
command is encountered.
|
||||||
\fIfileregex\fP. All subsequent \fBcolor\fR, \fBicolor\fR,
|
|
||||||
\fBheader\fR and other such statements will apply to this
|
|
||||||
\fIname\fP syntax until a new \fBsyntax\fR command is encountered.
|
|
||||||
|
|
||||||
The \fBnone\fP syntax is reserved; specifying it on the command line is
|
When \fBnano\fR is run, this syntax will be automatically
|
||||||
the same as not having a syntax at all. The \fBdefault\fP syntax is
|
activated if the current filename matches the extended regular
|
||||||
special: it takes no \fIfileregex\fP, and applies to files that don't
|
expression \fIfileregex\fR. Or the syntax can be explicitly
|
||||||
match any syntax's \fIfileregex\fP.
|
activated by using the \fB-Y\fR or \fB\-\-syntax\fR
|
||||||
|
command-line option followed by the \fIname\fR.
|
||||||
|
|
||||||
|
The syntax "\fBdefault\fP" is special: it takes no \fIfileregex\fR,
|
||||||
|
and applies to files that don't match any syntax's regexes.
|
||||||
|
The syntax "\fBnone\fP" is reserved; specifying it on the command line
|
||||||
|
is the same as not having a syntax at all.
|
||||||
.TP
|
.TP
|
||||||
.BI linter " program " \fR[ "arg " \fR...]
|
.BI linter " program " \fR[ "arg " \fR...]
|
||||||
Use the given \fIprogram\fR to run a syntax check on the current file
|
Use the given \fIprogram\fR to run a syntax check on the current file.
|
||||||
(this overrides the speller function when defined).
|
(This overrides the speller function.)
|
||||||
.TP
|
.TP
|
||||||
.BI formatter " program " \fR[ "arg " \fR...]
|
.BI formatter " program " \fR[ "arg " \fR...]
|
||||||
Use the given \fIprogram\fR to automatically reformat text.
|
Use the given \fIprogram\fR to automatically reformat text --
|
||||||
Useful in certain programming languages (e.g. Go).
|
useful in a programming language like Go.
|
||||||
|
(This overrides the speller and linter functions.)
|
||||||
.TP
|
.TP
|
||||||
.BR header " \fIregex\fR " ...
|
.BR header " \fIregex\fR " ...
|
||||||
Add one or more regexes which will
|
Add one or more regexes which will
|
||||||
|
@ -374,13 +378,13 @@ Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
|
||||||
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
|
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
|
||||||
to \fBicolor\fP.
|
to \fBicolor\fP.
|
||||||
.TP
|
.TP
|
||||||
.BI extendsyntax " name directive " \fR[ "arg " \fR...]
|
.BI extendsyntax " name command " \fR[ "arg " \fR...]
|
||||||
Extend the syntax previously defined as \fIname\fP to include
|
Extend the syntax previously defined as \fIname\fR with another
|
||||||
new information. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
\fIcommand\fR. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
||||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fP
|
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fP
|
||||||
directive to an already defined syntax -- useful when you want to
|
command to an already defined syntax -- useful when you want to
|
||||||
slightly improve a syntax defined in one of the system-installed
|
slightly improve a syntax defined in one of the system-installed
|
||||||
files (which are normally not writable).
|
files (which normally are not writable).
|
||||||
|
|
||||||
.SH REBINDING KEYS
|
.SH REBINDING KEYS
|
||||||
Key bindings can be changed via the following two commands:
|
Key bindings can be changed via the following two commands:
|
||||||
|
|
Loading…
Reference in New Issue