Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
f4c3670f
Commit
f4c3670f
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
docs: reword the explanation of the 'syntax' command
parent
6d121cc8
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/nano.texi
+23
-18
doc/nano.texi
doc/nanorc.5
+26
-22
doc/nanorc.5
with
49 additions
and
40 deletions
+49
-40
doc/nano.texi
View file @
f4c3670f
...
...
@@ -934,26 +934,30 @@ via the following commands in a nanorc file:
@table @code
@item syntax "@var
{
name
}
" ["@var
{
fileregex
}
" @dots
{}
]
Defines a syntax named "name" which can be activated via the @option
{
-Y
}
or @option
{
--syntax
}
command-line option, or will be automatically activated if the current
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
}
Start the definition of a syntax with this @var
{
name
}
.
All subsequent @code
{
color
}
and other such commands
will be added to this syntax, until a new @code
{
syntax
}
command is encountered.
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
syntax's "fileregex".
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
}
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
{}
]
Use the given program to do a syntax check on the current file
(
t
his overrides the speller function
when defined)
.
Use the given
@var
{
program
}
to do a syntax check on the current file
.
(
T
his overrides the speller function.
)
@item formatter @var
{
program
}
[@var
{
arg
}
@dots
{}
]
Use the given program to automatically reformat text.
Useful in certain programming languages (e.g.@: Go).
Use the given @var
{
program
}
to automatically reformat text ---
useful for a programming language like Go.
(This overrides the speller and linter functions.)
@item header "@var
{
regex
}
" @dots
{}
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
}
to @code
{
icolor
}
.
@item extendsyntax @var
{
name
}
@var
{
directive
}
[@var
{
arg
}
@dots
{}
]
Extend the syntax previously defined as "name"
to include new information
.
@item extendsyntax @var
{
name
}
@var
{
command
}
[@var
{
arg
}
@dots
{}
]
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
}
,
@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
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
...
...
This diff is collapsed.
Click to expand it.
doc/nanorc.5
View file @
f4c3670f
...
...
@@ -70,7 +70,7 @@ the file's name.
.TP
.B set backupdir "\fIdirectory\fP"
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.
The uniquely numbered files are stored in the specified \fIdirectory\fR.
.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
good fit for a small editor like \fBnano\fR.
.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:
.TP
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
Defines a syntax named \fIname\fP which can be activated via the
.BR \-Y / \-\-syntax
command-line option, or will be automatically activated if
the current filename matches the extended regular expression
\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.
Start the definition of a syntax with this \fIname\fR.
All subsequent \fBcolor\fR and other such commands
will be added to this syntax, until a new \fBsyntax\fR
command is encountered.
The \fBnone\fP syntax is reserved; specifying it on the command line is
the same as not having a syntax at all. The \fBdefault\fP syntax is
special: it takes no \fIfileregex\fP, and applies to files that don't
match any syntax's \fIfileregex\fP.
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
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
.BI linter " program " \fR[ "arg " \fR...]
Use the given \fIprogram\fR to run a syntax check on the current file
(
t
his overrides the speller function
when defined)
.
Use the given \fIprogram\fR to run a syntax check on the current file
.
(
T
his overrides the speller function.
)
.TP
.BI formatter " program " \fR[ "arg " \fR...]
Use the given \fIprogram\fR to automatically reformat text.
Useful in certain programming languages (e.g. Go).
Use the given \fIprogram\fR to automatically reformat text --
useful in a programming language like Go.
(This overrides the speller and linter functions.)
.TP
.BR header " \fIregex\fR " ...
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
to \fBicolor\fP.
.TP
.BI extendsyntax " name
directive
" \fR[ "arg " \fR...]
Extend the syntax previously defined as \fIname\f
P to include
new information
. This allows adding a new \fBcolor\fP, \fBicolor\fP,
.BI extendsyntax " name
command
" \fR[ "arg " \fR...]
Extend the syntax previously defined as \fIname\f
R with another
\fIcommand\fR
. This allows adding a new \fBcolor\fP, \fBicolor\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
files (which
are
normally not writable).
files (which normally
are
not writable).
.SH REBINDING KEYS
Key bindings can be changed via the following two commands:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help