Commit Graph

267 Commits (master)

Author SHA1 Message Date
Benno Schulenberg c275c5158e rcfile: introduce the modifier "bold", for specifying bolding separately
This makes it possible to avoid the misnamed prefix "bright".  It is
misnamed because (on current terminal emulators, when the brightening
of bold is switched off) it just makes the typeface bold, not the color
brighter.  The prefix "light" will now only make the color brigther,
and the modifier "bold" will just make the typeface bold (on terminal
emulators, when the brightening of bold is switched off).

On a Linux console, which is not capable of bolding the typeface,
"bold" will brighten the color.

This fully fulfills https://savannah.gnu.org/bugs/?58503.
2020-06-14 11:54:18 +02:00
Benno Schulenberg adf7f33ea8 rcfile: allow specifying a bright background color (with prefix "light")
If the terminal is capable of more than eight colors, specifying
indexes 8 to 15 works fine for getting a light background color.
2020-06-14 11:51:00 +02:00
Benno Schulenberg 4d10f583e4 rcfile: accept prefix "light" to make a color brighter without bolding it
The prefix "bright" will continue to make the color brighter AND/OR
make the typeface bold (depending on how the terminal is configured
and on its capabilities), but the prefix "light" will just make the
color brighter (if the terminal can do that).

The prefix "bright" continues to do the same as what it did before,
to not change the appearance of user-defined syntaxes.  And having
an option to change the meaning of "bright"... would be confusing.

This partially fulfills https://savannah.gnu.org/bugs/?58503.
2020-06-14 11:45:45 +02:00
Benno Schulenberg 32ee39e44a docs: document the --indicator (-q) and 'set indicator' options 2020-06-04 18:52:28 +02:00
Benno Schulenberg d9106abfda rcfile: rename 'extcmd' to 'execute', to be more readable and fitting
Also, improve its description in the documentation.
2020-05-31 12:04:58 +02:00
Ryan Westlund 3480518a5c syntax: go: highlight the chan keyword, and the special +build comment
This fixes https://savannah.gnu.org/bugs/?58424
Reported-by: Ryan Westlund <rlwestlund@gmail.com>

Signed-off-by: Ryan Westlund <rlwestlund@gmail.com>
2020-05-26 16:50:31 +02:00
Benno Schulenberg d4ee6a2b53 options: rename --tempfile to --saveonexit, to be far clearer
A long option should describe what it does, not vaguely hint at it.

Also, in several places of nano's code we deal with actual temp files,
and then having a flag called TEMP_FILE that doesn't have anything to
do with temp files is somewhat confusing.
2020-04-30 19:12:54 +02:00
Benno Schulenberg e62a6964f7 syntax: sql: condense some regexes, and reduce their number 2020-04-26 19:32:44 +02:00
Benno Schulenberg 227467adb9 syntaxes: remove some superfluous outer parentheses from regexes
Also, standardize some comments, condense a few regexes, add some
word-edge anchors, and remove some superfluous backslashes.
2020-04-21 12:49:29 +02:00
Benno Schulenberg afce41c754 syntaxes: move the rules for Fortran and Povray files down to extra/
Fortran and POV-Ray files are not found on any regular install of a
Unixy system nor in common software packages.  People who want these
syntaxes will have to make a little effort to enable them.
2020-04-21 12:11:44 +02:00
Ryan Westlund 36e22c99a1 syntax: haskell: new file -- coloring rules for Haskell programs
Adapted from the original coloring rules by Alex Taber found at:
  https://github.com/scopatz/nanorc/blob/master/haskell.nanorc

Signed-off-by: Ryan Westlund <rlwestlund@gmail.com>
2020-04-21 11:56:24 +02:00
Benno Schulenberg dd25d807df syntaxes: remove some stuff that has been commented out for a long time 2020-04-20 19:22:39 +02:00
Benno Schulenberg fea5d7c612 syntaxes: uniformize the initial comment 2020-04-20 19:21:56 +02:00
Benno Schulenberg c859fd40b6 syntax: markdown: do not colorize text between two bold words as italic
Also, do not colorize the text between two stricken-through words,
do not colorize text immediately after an indented piece of code,
but do give color to a double trailing space.

Signed-off-by: Ryan Westlund <rlwestlund@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2020-04-20 13:42:00 +02:00
Benno Schulenberg 56d1214187 syntax: move distro-specific files down to a subdirectory, syntax/extra/ 2020-04-14 19:05:41 +02:00
Benno Schulenberg fb53ad9c3a syntax: markdown: new file -- coloring rules for Markdown files
First-draft-by: Ryan Westlund <rlwestlund@gmail.com>
2020-04-14 16:15:49 +02:00
Benno Schulenberg fd9f6e4619 syntax: mgp: drop the almost-empty MagicPoint file and syntax
It colored any word after a % sign.  But a good syntax would color
only the valid commands, and also the ones after a comma.
2020-04-12 10:40:29 +02:00
Benno Schulenberg 4f9bebddec syntax: email: rename file and syntax, away from the mistaken 'mutt'
Also, colorize lines that are multiply quoted, and email addresses,
and URLs.
2020-04-10 13:01:57 +02:00
Benno Schulenberg a91bc04e04 docs: update the form of an option, --suspendable / 'set suspendable' 2020-03-13 15:58:56 +01:00
Benno Schulenberg e09ed765a1 syntax: nanorc: colorize 'rawsequences', not the obsolete 'rebindkeypad'
Bug existed since version 4.0, commit b596639f.
2020-03-10 16:21:02 +01:00
Benno Schulenberg 9c70fdaef9 syntax: spec: drop invalid parentheses after "Summary"
Also, add the missing "RemovePathPostfixes", add extra word boundaries,
and reshuffle and regroup some things.
2020-02-25 11:47:11 +01:00
Benno Schulenberg 6c6a3f6bd3 syntax: spec: colorize the date and author of changelog items differently
Also, remove superfluous parentheses, add missing edge-of-word markers,
correct the "ppciseries" keyword, and fold some regexes (or elements of
them) together.
2020-02-23 20:02:48 +01:00
Benno Schulenberg e873121372 syntax: spec: add two missing % signs, and colorize also "%triggerprein"
Furthermore, actually colorize the header line of a %changelog entry,
and remove two redundant fragments and simplify their overrides.
2020-02-23 19:38:54 +01:00
Neal Gompa ad52830fb8 syntax: spec: add some keywords that were added in RPM 4.15 and 4.13
In RPM 4.15, a number of new spec section features were introduced:

* %dnl                       - macro-engine level comments
* %elif, %elifos, %elifarch  - 'else if' stanzas for conditionals
* %sourcelist                - section for listing sources line by line
* %patchlist                 - section for listing patches line by line
* %generate_buildrequires    - script section after %prep for
                               generating build dependencies

(Reference: https://rpm.org/wiki/Releases/4.15.0.html.)

An enhancement added in RPM 4.13:

* Sections for file trigger stanzas

(Reference: https://rpm.org/user_doc/file_triggers.html.)

As these are being increasingly used in Fedora and other distributions,
it's quite helpful to have syntax highlighting be up to date on handling
them.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2020-02-23 15:12:04 +01:00
Benno Schulenberg 2651554721 syntax: nanorc: colorize all-lowercase Meta key binds as valid too
Also, colorize as valid only ASCII letters, not any Unicode letters.
2020-01-23 13:34:37 +01:00
Benno Schulenberg f9baa4de71 syntax: nanohelp, nanorc: colorize the Sh-M-X format as a valid key name 2020-01-23 11:11:34 +01:00
Benno Schulenberg 54b97a6f03 bindings: allow to rebind also ^`, although it is synonymous with ^Space
Since ^@ is rebindable too and also a synonym of ^Space, it makes
more sense to allow the user to specify ^` instead, as it is an
unshifted keystroke on US keyboards.

Also, color ^` as valid in a nanorc file, and color ^` and ^@ in
the help viewer.
2020-01-20 17:19:23 +01:00
Benno Schulenberg 26d88ccbb1 syntax: sh: recognize shell rc files also in dedicated directories
This fulfills https://savannah.gnu.org/bugs/?57411.
2019-12-16 19:09:48 +01:00
Benno Schulenberg 00b0316ab8 syntax: nanohelp: colorize also ^/ as a possible keystroke
(In addition, colorize F20...F24 too.)

This fixes https://savannah.gnu.org/bugs/?57390.

Bug existed since version 4.6, commit 2a97cb9f.
2019-12-10 15:42:28 +01:00
Benno Schulenberg 2a97cb9f41 bindings: allow to rebind ^/, even though it is synonymous with ^_
This fixes https://savannah.gnu.org/bugs/?57302.
Reported-by: Tiago Almeida <tjamadeira@gmail.com>
2019-11-26 19:25:24 +01:00
Benno Schulenberg 302ea79d1c syntaxes: put the 'linter' and 'formatter' commands on a separate line
To show that they are a different class of thing than the file-matching
regexes and the comment thing, which all kind of "describe" the file.
2019-11-04 20:56:41 +02:00
Benno Schulenberg ebeed9c013 tweaks: fuse two regexes into one 2019-11-04 20:49:17 +02:00
Benno Schulenberg 75dd9bee38 syntax: javascript: colorize the boolean values 'true' and 'false' too
Original-patch-by: Ryan Westlund <rlwestlund@gmail.com>
2019-11-03 19:50:41 +02:00
Benno Schulenberg 3f3698640b syntax: ruby: colorize also lowercase global/instance variables
And avoid recoloring the reserved words BEGIN and END as constants.

Inspired-by: Rory Thrasher <thrasher@redhat.com>
2019-10-27 16:34:06 +01:00
Benno Schulenberg b4dbbe3799 syntax: html: add a formatter command, making use of 'tidy' 2019-10-25 17:27:14 +02:00
Benno Schulenberg 4281b6becb commands: rename 'fixer' to 'formatter', to be less misleading
The word "fixer" sounds too much as if the command would be able
to fix mistakes or correct errors.  Especially when seen next to
"linter", it sounds as if one does a syntax check and the other
fixes the found mistakes.  (Although the command might in theory
be used for this, it is not its intended purpose.)
2019-10-25 17:24:28 +02:00
Benno Schulenberg 34b1824822 syntax: default: don't colorize stuff between two pairs of brackets
That is, don't allow another bracket between the opening and the
closing bracket.
2019-10-25 12:23:40 +02:00
Jeroen Roovers b025f67805 syntax: gentoo: highlight the BDEPEND variable as well
This fixes https://bugs.gentoo.org/698420.
Reported-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2019-10-24 17:24:06 +02:00
Benno Schulenberg 40f8ca0d07 syntax: html: colorize only full attributes, and colorize strings later
Attribute names that are a part of another word should not be colored,
nor should attribute names within strings.

This addresses the other half of https://savannah.gnu.org/patch/?9865.
Original-patch-by: Ryan Westlund <rlwestlund@gmail.com>
2019-10-24 17:19:04 +02:00
Benno Schulenberg aae752912e syntax: javascript: colorize also special values 'null' and 'undefined'
This addresses one half of https://savannah.gnu.org/patch/?9865.
Original-patch-by: Ryan Westlund <rlwestlund@gmail.com>
2019-10-24 17:19:04 +02:00
Benno Schulenberg 3d5e51bcd0 syntax: nanorc: colorize in bright red everything that is invalid
Random words or mistyped keywords should not stay uncolored.
2019-10-20 14:47:15 +02:00
Benno Schulenberg 69d2045c9f syntax: nanorc: colorize only lowercase keywords as valid
Nowhere does the manual say that nanorc keywords are case-insensitive,
and none of the examples use uppercase keywords.  So, simply consider
uppercase keywords to be invalid.  This will later allow nano to use
case-sensitive comparisons, which are slightly faster.
2019-10-14 11:45:56 +02:00
Benno Schulenberg b8dc8d4a37 syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid 2019-10-14 10:28:45 +02:00
Benno Schulenberg 8749ccb469 syntax: nanorc: colorize the 'fixer' command as valid
Also add a default formatting command to the Go syntax.
2019-10-14 10:28:45 +02:00
Benno Schulenberg f813fd0f4d rcfile: allow binding also F17...F24
For historical reasons the rebinding code allows binding F13...F16,
which on most terminals are typable with Shift plus F1...F4.  But,
at least on an Xfce Terminal, Shift plus F1...F12 produce F13...F24.
On a Linux console, Shift plus F1...F8 produce F13...F20.  So: allow
to bind the full shifted F13...F24 range.  It costs no extra code
and makes things more rounded.
2019-10-07 16:23:40 +02:00
Benno Schulenberg 2698a2ba68 syntax: c: recognize some C++ header files by their Emacs modeline
For extensionless files, recognize C/C++ ones from the mode name
between the -*- marks on the first line.

This addresses https://savannah.gnu.org/patch/?9719.

Inspired-by: Devin Hussey <husseydevin@gmail.com>
2019-10-06 12:01:02 +02:00
Benno Schulenberg 108a3b0b41 tweaks: sort two keywords strictly alphabetically 2019-09-29 15:11:15 +02:00
Dirkjan Ochtman e9d6ceab0b syntax: rust: add the words reserved in 2018, and remove unreserved ones
See https://doc.rust-lang.org/reference/keywords.html,
and https://rust-lang.github.io/rfcs/2421-unreservations-2018.html.

Signed-off-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-09-28 13:29:23 +02:00
Benno Schulenberg 3644d51b97 new feature: a 'tabgives' command to define what the Tab key produces
The 'tabgives' command is syntax-specific and should be followed by a
string containing the character(s) that a single press of the <Tab> key
should produce -- most likely a single TAB or a small bunch of spaces,
but any string is allowed.  This overrides the 'tabstospaces' option.

When one wants to make sure <Tab> inserts always four spaces and never
a TAB when editing a Python file, one could add to one's nanorc:

  extendsyntax python tabgives "    "

where there are four spaces between the quotes.  And when one wants
to ensure, when editing a Makefile, that <Tab> always inserts a TAB
and never spaces, independent of what tabstospaces is set to, one
could add to one's nanorc:

  extendsyntax makefile tabgives "	"

where there is a literal TAB character between the quotes.

This fulfills https://savannah.gnu.org/bugs/?53661,
Requested-by: Andrew Pennebaker <andrew.pennebaker@gmail.com>
And addresses https://savannah.gnu.org/bugs/?54760.
Requested-by: Henry van Megen <hvanmegen@gmail.com>
And addresses part of https://savannah.gnu.org/bugs/?54775.
Requested-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2019-09-25 19:35:07 +02:00
Benno Schulenberg bdf1a9d4e7 syntax: perl: avoid upsetting older glibcs with crafty range expression
The regcomp() function from glibc-2.27 (and older) considers the
bracket expression ['-.] to be invalid -- mistakenly.  Avoid using
any range expression in the relevant regex and instead enumerate
all acceptable characters.

This avoids https://savannah.gnu.org/bugs/?56766.
2019-08-19 17:15:29 +02:00
Benno Schulenberg f2f367ba9c syntaxes: change some unneeded 'icolor' commands to 'color' commands 2019-08-17 17:01:19 +02:00
Benno Schulenberg cd274a7830 syntax: perl: don't color the character after a variable name
And generally improve the regex for coloring Perl variable names.

This fixes https://savannah.gnu.org/bugs/?56713.
With-help-from: Brand Huntsman <alpha@qzx.com>

Bug existed since the Perl syntax was introduced,
in version 1.2.2, commit 70047eef.
2019-08-14 09:24:32 +02:00
Benno Schulenberg f773fa3968 syntax: default: colorize bracketed section headers in some config files 2019-08-14 09:18:51 +02:00
Benno Schulenberg 288355686b syntax: c: allow an underscore in lowercase type names 2019-08-11 20:06:46 +02:00
Benno Schulenberg ee91c51e09 syntax: perl: avoid recognizing embedded hash signs as a comment starter
Require that a comment starts at the start of a line or is preceded by
whitespace.  This prevents most hash signs used for other purposes (and
what follows them) getting colored as comments.
2019-08-08 12:08:34 +02:00
Benno Schulenberg 1e3f3a7511 syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
This brings color to CakePHP template files, and to CUDA files.

This addresses https://bugs.debian.org/932192.
Requested-by: Jérôme Bardot <bardot.jerome@gmail.com>
2019-08-08 12:02:07 +02:00
Benno Schulenberg 3b8847f319 syntax: po: colorize numbers only when they form a self-contained word 2019-07-29 19:12:58 +02:00
Benno Schulenberg 8f1cd50f1e syntax: python: avoid miscoloring stuff between two empty strings
The quotes of an empty string ('' or "") should be colored just like
those of a non-empty string, because otherwise the text *between* two
empty strings on the same line gets colored.

Add an extra rule to discolor triple quotes again to not make them
look like valid by themselves.

Also, remove six superfluous backslashes.

This addresses https://savannah.gnu.org/patch/?9801.
Reported-by: Ryan Westlund <rlwestlund@gmail.com>
2019-05-11 19:05:45 +02:00
Benno Schulenberg dfe87540c6 syntax: po: colorize also escaped hex and octal codes 2019-05-03 12:12:44 +02:00
Liu Hao c9605e7308 syntax: c: change the highlighting of preprocessor directives
Some of these directives are now colored in their entirety, while for
a few others it's still just the keyword itself that is colored.

Signed-off-by: Liu Hao <lh_mouse@126.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-04-06 17:51:07 +02:00
Benno Schulenberg 5375403b9d syntax: nanorc: colorize also strings preceded by 'start=' or 'end=' 2019-04-02 12:01:56 +02:00
Benno Schulenberg f8e0320722 syntax: nanorc: require whitespace both before and after a quoted string
This ensures that the keyname M-" is not miscolored.
2019-04-01 17:24:19 +02:00
Benno Schulenberg 85804ec70d syntax: man: require the dot to be at start of line, not the comment 2019-03-31 12:42:53 +02:00
Benno Schulenberg e473ba5e6c syntax: man: anchor macros at start of line, as only then they are valid 2019-03-30 20:54:31 +01:00
Benno Schulenberg 9120a62cdd syntax: man: add comments, and color all the safe lowercase macros 2019-03-30 20:47:45 +01:00
Benno Schulenberg 53ecb3225f syntax: default: color in red also versions 4.x of nano 2019-03-30 19:54:58 +01:00
Benno Schulenberg 92cbc7c426 syntax: c: color as a type any lowercase word that ends with "_t" 2019-03-30 17:48:34 +01:00
Benno Schulenberg 9ad3a17954 syntax: nanorc: stop coloring 'unset fill ...' as if it were valid
The same for 'unset tabsize ...'.

Also, color 'set guidestripe' plus a following number as valid.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 916b4d81d0 rcfile: add 'stripecolor' for changing the color of the guiding stripe
The default is now simply reverse video, which works better than a
"loud" colored bar in an interface that for the rest is monochrome.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 4d40bea58a rcfile: add the options that correspond to -b, -f, -j, and -e 2019-02-18 09:34:18 +01:00
Benno Schulenberg 670dd9bbe0 tweaks: condense two regexes in the Tcl syntax, and add a comment
Also, make a range of characters more explicit.
2018-12-17 16:00:54 +01:00
Benno Schulenberg 9cdc64c97a syntax: tcl: colorize comments normally, not with a background hue
This makes for a less "messy" and more readable appearance.

Suggested-by: Michael Siegel <msi@malbolge.net>
2018-12-17 15:35:56 +01:00
Benno Schulenberg 5acfa5bb7b tweaks: slightly indent warnings and errors during the configure phase
To make them stand out in the waterfall of messages.
2018-12-16 14:41:31 +01:00
Benno Schulenberg e938c24d04 tweaks: renumber a couple of symbols, and reshuffle a bit of code
Also, contract the regex for key strings.
2018-11-07 19:30:04 +01:00
David Lawrence Ramsey f55a3fabef input: recognize some escape sequences for <Shift+Delete>
Also, hard-bind <Shift+Delete> in the same way as <Backspace>.

This fixes https://savannah.gnu.org/bugs/?54948,
and fixes https://savannah.gnu.org/bugs/?54975.
2018-11-07 19:17:16 +01:00
Brand Huntsman ae3ec1784d options: add --zap, that makes <Bsp> and <Del> erase a marked region
Using --zap or -Z on the command line, or 'set zap' in a nanorc file,
makes the <Bsp> and <Del> keys erase selected text (a marked region)
as they do in some other editors, and without affecting the cutbuffer.

This fulfills https://savannah.gnu.org/bugs/?54837.
Requested-by: Liu Hao <lh_mouse@126.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-11-04 11:46:57 +01:00
Benno Schulenberg 02eaa4ce6d tweaks: fold a few pairs of regexes into each other 2018-11-03 21:32:07 +01:00
Benno Schulenberg 636e9ac3e8 syntaxes: remove several redundant end-of-line anchors from regexes 2018-11-03 21:12:44 +01:00
Benno Schulenberg af71d44e4e tweaks: snip trailing whitespace that ended with a non-breaking space 2018-11-03 20:41:42 +01:00
David Lawrence Ramsey 5f1b618a5a syntax: nanohelp: properly color the keystroke "Sh-^Del"
This fixes https://savannah.gnu.org/bugs/?54758.
2018-09-30 20:40:20 +02:00
Benjamin Mintz 790f98560b syntax: python: do not highlight 'print' and 'exec' in Python 3
Assume that 'print' and 'exec' are statements when they are followed
by whitespace, and are functions otherwise.  This does not highlight
"print'x'" nor "print{x}", but these statements are poor style.

Signed-off-by: Benjamin Mintz <bmintz@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-09-20 20:45:01 +02:00
Benno Schulenberg e2051a61e0 syntax: sh: let the header regex match also busybox shell scripts
And recognize calls via 'env' too.

This addresses https://savannah.gnu.org/bugs/?54674.
Reported-by: Aaron Sears <geodelic@gmail.com>
2018-09-18 19:06:11 +02:00
Benno Schulenberg 921f8ae4c9 syntax: default: colorize also two-digit and capitalized nano versions 2018-08-30 19:46:34 +02:00
Mark-Weston bf5949395d syntax: lua: do not color strings inside comments, and add a linter
Also, don't partially color "..." as an operator, because it isn't,
and color also the unary operator "#".

Signed-off-by: Mark-Weston <markweston@cock.li>
2018-08-28 20:16:16 +02:00
Benno Schulenberg c524fbe6d0 tweaks: remove some ineffectual parts from header-line regexes
Adding "[abc]*" does not restrict the recognized header line in any way.

Also, improve the header-line regex for shell scripts, because it should
not match "barunscript" (for example).
2018-08-28 19:53:36 +02:00
Benno Schulenberg 850e538ff7 syntax: python: avoid coloring the three special values inside strings
Reported-by: Benjamin Mintz <bmintz@protonmail.com>
Suggested-by: Brand Huntsman <alpha@qzx.com>
2018-08-16 19:56:01 +02:00
Benno Schulenberg 18419b5e3f syntax: awk: recognize any {g,m,n,}awk script also by its shebang line
This fulfills https://savannah.gnu.org/bugs/?54516.

Suggested-by: Javier Valencia <javiervalencia80@gmail.com>
2018-08-15 20:20:22 +02:00
Benno Schulenberg 2d434f63e2 syntaxes: remove all traces of the 'formatter' command 2018-08-09 21:12:10 +02:00
Benno Schulenberg db1893ef2d syntax: nanorc: recognize 'yesno' as a valid menu to bind/unbind keys in 2018-08-06 18:05:10 +02:00
Benno Schulenberg ac102a7516 tweaks: show "Space" and "Bsp" in the help text of the browser
These keys make more mnemonic sense for scrolling than F7 and F8.

Also adjust the nanohelp syntax to cover the lone word "Space".
2018-07-31 20:36:32 +02:00
Devin Hussey 4a268678a5 syntax: sh: recognize more file extensions and header lines
Signed-off-by: Devin Hussey <husseydevin@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-07-20 19:12:20 +02:00
Benno Schulenberg acadf71b13 syntax: nanorc: show ^@ as validly rebindable, but not any ^digit 2018-07-11 14:14:40 +02:00
Benno Schulenberg 8492de53f7 syntax: makefile: color all keywords that GNU make recognizes
Plus one that automake recognizes: if.  Color them only at the start
of a line.  Also color all possible assignment sequences (surrounded
by spaces to not color the ones in shell fragments), and add some
comments.
2018-05-30 11:29:08 +02:00
Cristian Caloghera 22663f8a2e syntax: makefile: recognize also an all-lowercase makefile name
Recognize not just "Makefile" but also "makefile" and "GNUmakefile".
And recognize these only when they are the full filenames, not when
they are the tail part of a longer name.

Signed-off-by: Cristian Caloghera <cristi.caloghera@gmail.com>
2018-05-22 20:41:43 +02:00
Benno Schulenberg cdd637d69f syntaxes: condense and/or correct some extension regexes 2018-05-18 20:40:08 +02:00
Mark-Weston 858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg 30a984661b syntax: po: highlight also other escaped characters, not just \n
Especially color \a and \t, to make it easier to distinguish them
from contiguous text.
2018-04-17 09:56:19 +02:00
Benno Schulenberg cf1129a8b4 syntax: sh: colorize options only when they are preceded by whitespace
To prevent any filenames containing hyphens getting partially colored.

Reported-by: Brand Huntsman <alpha@qzx.com>
2018-03-30 10:46:56 +02:00
Benno Schulenberg 0bce5ba4d9 syntax: sh: color options distinctively, and color also long options
Also add some comments, and accept hyphens in function names.
2018-03-29 09:51:39 +02:00
Benno Schulenberg 20d1823d90 syntax: sh: uncolor "tar" when it's part of a filename 2018-03-28 14:04:00 +02:00
Benno Schulenberg e01bcddf16 docs: document the newly added color name "normal" 2018-03-28 14:03:52 +02:00
Benno Schulenberg 1de3667555 syntax: sh: color also the 'cut', 'head', 'tail', and 'sort' commands 2018-03-27 14:09:38 +02:00
Benno Schulenberg ae9ec6d4ad syntax: nanorc: color also bindings to a string as valid 2018-03-01 10:09:28 +01:00
Benno Schulenberg 8f1a657a37 bindings: revert the ^/ changes, as ^/ is not always Go-To-Line
On a Linux console, ^/ produces Backspace, making it unrebindable.

This fixes https://savannah.gnu.org/bugs/?53248.
2018-03-01 09:50:54 +01:00
Benno Schulenberg 082e5db4b7 syntax: color also ^/ in nano's help texts and in nanorc files
As of commit c79fe1a1, the more readable ^/ has replaced ^_ as the
advertised shortcut for Go-To-Line -- color it too as valid.
2018-02-27 18:06:33 +01:00
Benno Schulenberg b027263a37 small addition: allow customizing the color of an error message
The new option 'set errorcolor' allows the user to specify the color
combination for the status bar when an error message is displayed.
2018-02-23 12:35:17 +01:00
Tom Levy fef195bce9 syntax: go: highlight also floats with leading zeroes as valid
See the discussion on the mailing list:
https://lists.gnu.org/archive/html/nano-devel/2018-01/msg00022.html
https://lists.gnu.org/archive/html/nano-devel/2018-02/msg00090.html

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-02-20 10:31:38 +01:00
Benno Schulenberg 3e1fc6385b syntaxes: remove quotes from each syntax name, and color it differently
The different color will make the name stand out, as it should, instead
of looking the same as all the regex strings.
2018-02-14 17:36:50 +01:00
Benno Schulenberg 452008c81d syntax: go: colorize only valid octal numbers
Reported-by: Tom Levy <tomlevy93@gmail.com>
2018-01-26 11:15:26 +01:00
Benno Schulenberg 8067efa6cc syntax: nanohelp: color also the Sh-Tab key combo 2018-01-09 16:34:31 +01:00
Benno Schulenberg c6f367268b syntax: lua: do not color debug.setinfo as it doesn't exist
Reported-by: Tom Levy <tomlevy93@gmail.com>
2018-01-06 17:59:28 +01:00
Benno Schulenberg 5965e80a38 tweaks: fold some regexes into one another, for conciseness
The anchored "^texture" appears to have been a mistake.

Inspired-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 16:00:18 +01:00
Tom Levy a794c3318b syntax: go: sign of exponent in number literal is optional
Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 15:27:31 +01:00
Tom Levy d04b0c123e syntax: go: fix word boundary before dot in number literal
The fragment "\<\." can never match anything because \< matches the
beginning of a word but "." is not a word character.

Replace \< with \B (the empty string not at the edge of a word).

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 15:25:26 +01:00
Benno Schulenberg 21cd953e85 syntax: lua: condense some regexes, tweak comments, reorder things
Also remove some redundant backslashes and parentheses.
2018-01-01 14:59:00 +01:00
Tom Levy 058b9da9b9 syntax: lua: add new and missing standard library functions
The list now includes all the Lua 5.3 functions listed on
https://www.lua.org/manual/5.3/#index.

Also, remove the coloring of just the library name, so that
only known library functions get highlighted.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 14:35:19 +01:00
Tom Levy 38a10a62d0 syntax: lua: support fractional part and exponent for decimal and hex
As of Lua 5.2: "Hexadecimal constants also accept an optional fractional
part plus an optional binary exponent, marked by a letter 'p' or 'P'"
(see at the end of https://www.lua.org/manual/5.2/manual.html#3.1).

The new regexes do not match a leading nor a trailing dot, but they
are good enough.  Discussion on the mailing list:
https://lists.gnu.org/archive/html/nano-devel/2017-12/msg00121.html

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 14:15:14 +01:00
Tom Levy 091e8faf6d syntax: lua: require at least one digit for hexadecimal numbers
Since a "0x" by itself is invalid.  Also add word boundaries, so that
e.g. "00x1" (which is invalid) does not get partial highlighting.

Also remove some redundant backslashes from the strings regex.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 13:51:10 +01:00
Benno Schulenberg 1f48ed0412 syntaxes: remove redundant word-boundary markers 2017-12-30 17:32:15 +01:00
Tom Levy 4f2b01c7e5 syntax: lua: correct the word boundaries on standard library functions
Functions such as "io.close" should only be highlighted when the
package name ("io") is a word by itself, otherwise code such as
"fooio.close" gets unexpected partial highlighting.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2017-12-28 21:46:26 +01:00
Benno Schulenberg bdbd5ff0e7 syntax: javascript: add some comments, and color explicit numbers too 2017-12-25 16:03:05 +01:00
Benno Schulenberg f769465284 syntax: javascript: add some keywords, and sort them more logically
Also, remove angle-bracketed "strings" -- they don't exist.
2017-12-25 15:40:05 +01:00
Benno Schulenberg 1b5b52d2e4 syntax: javascript: color strings differently from major keywords
Also, remove the coloring of special single-quoted strings as they
get recolored by the subsequent general string-coloring command.

And remove the coloring of all-uppercase words, as other editors
do not color those either.
2017-12-25 15:36:35 +01:00
Benno Schulenberg ab62d28817 syntax: javascript: require that a comment is preceded by whitespace
Either by whitespace or by the start of a line.

This avoids treating part of a URL as a comment.
2017-12-25 15:25:04 +01:00
Mike Frysinger 8e0a7ec20d syntax: javascript: add newer keywords and string syntax 2017-12-25 15:08:03 +01:00
Michael Francis 53fc9a66a6 syntax: php: function and variable names can contain uppercase and digits
Reference: http://php.net/manual/en/language.variables.basics.php

Also color keywords differently from strings.

Signed-off-by: Michael Francis <mikefrancis95@gmail.com>
2017-12-11 21:02:36 +01:00
Benno Schulenberg ddb8e95d39 syntax: python: color also the special values 'False', 'None', 'True'
And increase the contrast for the reminders, both for PO and Python.
2017-12-10 14:35:13 +01:00
Benjamin Mintz fbac4505ce syntax: python: add 'async', 'await', and 'nonlocal' as keywords
A list of keywords can be obtained from `keyword.kwlist`.

Signed-off-by: Benjamin Mintz <bmintz@protonmail.com>
2017-12-10 14:23:51 +01:00
Liu Hao 5144162a2d syntax: c: increase the color contrast of reminders like FIXME
Bright white on yellow stands out much more than grey on yellow.

Signed-off-by: Liu Hao <lh_mouse@126.com>
2017-12-09 16:58:57 +01:00
Benno Schulenberg 66fd6a5ab1 options: rename 'justifytrim' to 'trimblanks', because it has morphed
The option now causes nano to trim trailing whitespace also when
hardwrapping occurs while the user is typing.
2017-12-06 20:38:13 +01:00
Benno Schulenberg 4761e00852 syntax: nanorc: don't color parts of valid strings as if invalid
It's better to color some invalid things as if valid than the other
way around.  So, as strings can validly contain any number of double
quotes, just accept *anything* between the delimiting double quotes
and demand that the closing quote is followed by whitespace or EOL.
2017-12-03 20:09:47 +01:00
Benno Schulenberg bacb0f717d syntax: adjust the magic strings for the changes since file-5.10
Since file-5.10 (end of 2011), libmagic identifies a C file in most
cases as "C source" instead of as "C program".  Nano's magic strings
for some other files didn't match any more what file-5.32 currently
produces, either.  So, they have been adjusted, new ones added, and
old ones deleted.

This fixes https://savannah.gnu.org/bugs/?52445.
2017-11-19 11:24:30 +01:00
Benno Schulenberg 14bf53ddfc syntax: default: use colors that are readable also on dark backgrounds 2017-10-26 21:07:11 +02:00
Benno Schulenberg 58ecc034d0 tweaks: change the help-text arrows to triangles, to be more visible
Requested-by: Brand Huntsman <alpha@qzx.com>
2017-10-15 21:23:33 +02:00
Benno Schulenberg d0119833c1 tweaks: reshuffle some regexes, for order and compactness 2017-10-11 21:52:18 +02:00
Brand Huntsman d4074ca85b syntax: nanohelp: colorize Up, Down, Left and Right (when not in UTF-8)
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2017-10-11 21:50:47 +02:00
David Lawrence Ramsey 3f35e9670f syntax: nanorc: properly color valid arguments of 'selectedcolor'
This fixes https://savannah.gnu.org/bugs/?52114.
2017-09-26 19:35:55 +02:00
Benno Schulenberg 3f0e42c13b syntax: c: give labels some color too 2017-08-15 11:00:31 +02:00
Benno Schulenberg 884d410d9d syntax: python: don't require a character after an opening triple quote
The succeeding character was needed to avoid miscolorings due to nano
getting confused about starts and ends.  But since commit 7ef5c532,
nano should be getting the starts and ends always right, so... undo
"temporary" commit 7b2ea405 from two years ago.

This addresses https://savannah.gnu.org/bugs/?51526.
Reported-by: <exodus6395@googlemail.com>
2017-08-06 09:50:34 +02:00
David Lawrence Ramsey 1c1cbae6bc small addition: allow customizing the color of selected text
The new option 'set selectedcolor' applies to marked text, to the
currently selected file in the file browser, and to the highlighted
match during interactive search-and-replace.
2017-08-06 09:30:32 +02:00
Benno Schulenberg 94b484ea97 syntax: html: don't bother coloring tags that cross line boundaries
Prefer speed above being fully correct.

This addresses https://savannah.gnu.org/bugs/?51644.
2017-08-03 21:18:34 +02:00
Benno Schulenberg 63c428ad08 options: rename --cut to --cutfromcursor, to be clearer
Rename the corresponding rc-file option too, of course.
2017-07-14 16:06:52 +02:00
Benno Schulenberg f55b65bd99 syntax: nanorc: don't color the argument of 'linter' as if invalid
Color it bright green instead, like valid numeric arguments of
'fill' and 'tabsize'.  Also color the argument of 'formatter'.
2017-07-14 15:32:56 +02:00
Benno Schulenberg fb5478338f syntax: texinfo: cover also some special cases like @U, @OE and @TeX 2017-07-14 10:29:36 +02:00
David Lawrence Ramsey bb4d0d548a new feature: allow lines to be softwrapped at whitespace
Extend get_softwrap_breakpoint() to break softwrapped lines on
whitespace when a flag is set.  This flag is controlled by the new
rcfile option "atblanks".  The '>' characters marking two-column
characters at the edge of the screen are disabled when it's on.

If get_softwrap_breakpoint() can't find whitespace in screen range, it
will break the line on the screen edge.  (In this case, a blank can be
on the last column of the screen, but text can't, so that a blank on the
last column doesn't become invisible and possibly break the display.)

This fulfills https://savannah.gnu.org/bugs/index.php?49959.
Requested-by: Nicholas Boel <axxisd@gmail.com>
2017-07-07 13:07:10 +02:00
Benno Schulenberg 79971a309f docs: remove the mention of backslashes for the argument of 'comment'
Also remove the backslashes from the two syntaxes that contained them.

This completes the fix for https://savannah.gnu.org/bugs/?51370.
2017-07-07 10:15:17 +02:00
Benno Schulenberg 09f516a58b syntax: man, groff: fix the string that introduces a comment
The comment marker is not «."» but «.\"», which requires three
backslashes to specify.  Also adjust the documentation.
2017-07-03 11:07:21 +02:00
Benno Schulenberg 1c05090a4a syntax: gentoo: make it clearer that the file contains two syntaxes 2017-07-02 20:27:04 +02:00
Benno Schulenberg 50cbde8b23 syntax: nanorc: don't color numeric arguments specially
Negative arguments of 'fill' are bright green since a few commits.
So now color all valid numeric arguments in that same style -- the
yellow was hard to see on a dark background anyway.

Also, color a zero tabsize as invalid.
2017-06-29 19:45:39 +02:00
David Lawrence Ramsey 2704b3874b syntax: nanorc: properly color a "fill" option with a negative value 2017-06-29 17:25:09 +02:00