328 Commits

Author SHA1 Message Date
Benno Schulenberg
a7e8dd7d6b options: accept --solosidescroll and 'set solosidescroll'
These options activate the old, jerky, single-line sideways scrolling
instead of the new default smooth whole-window sideways scrolling.
2026-01-23 17:37:03 +01:00
Benno Schulenberg
1ee74172c2 rcfile: accept also {}} in a string bind, for symmetry with {{} 2025-08-02 09:48:05 +02:00
Benno Schulenberg
b68d74effc syntax: po: colorize also the %b and %B format specifiers
Glibc's printf() recognizes these specifiers since version 2.35:
  https://sourceware.org/pipermail/libc-announce/2022/000033.html
2025-07-08 16:05:25 +02:00
Benno Schulenberg
a0918c5e98 tweaks: random unimportant edits here and there 2025-05-18 12:34:07 +02:00
Benno Schulenberg
84b1fdf6c6 syntaxes: add a license line to files that were created by Mike Frysinger
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-05-08 10:31:44 +02:00
Benno Schulenberg
2181853574 syntaxes: use character classes instead of range expressions
In some locales certain normal ASCII characters are not included in
the ranges [A-Z] and [a-z].  So, use [[:upper:]] and [[:lower:]]
instead, and [[:alpha:]] for [A-Za-z], and similarly for others.

This fixes https://savannah.gnu.org/bugs/?67094.
2025-05-08 10:24:49 +02:00
Benno Schulenberg
fabc1e1219 syntax: default: show hard spaces with a lightgrey background
Some keyboard layouts allow typing hard spaces (U+00A0),
which means that sometimes they can get typed by accident.
Colorize those spaces to make such accidents noticeable.

Inspired-by: Sébastien Desreux <seb@h-k.fr>
2025-04-26 12:18:42 +02:00
Benno Schulenberg
95731b800d options: accept --whitespacedisplay and 'set whitespacedisplay'
Allow some people to use 'set whitespacedisplay' in their rcfiles
(or --whitespacedisplay on the command line), but leave the option
undocumented as I think it shouldn't exist.
2025-04-25 17:07:28 +02:00
Benno Schulenberg
334604a591 syntax: po: colorize also format specifiers like "%.6f" 2025-03-17 12:48:04 +01:00
Benno Schulenberg
163c569919 syntax: po: colorize also format specifiers like "%<PRIu64>" 2025-02-28 11:34:42 +01:00
Benno Schulenberg
63a7be115a syntax: po: colorize also a 'msgctxt' line, and the 'c++-format' flag 2025-02-20 13:49:03 +01:00
Benno Schulenberg
fed31f2a79 syntax: po: colorize also Python's "%(name)x" format specifiers 2025-02-17 13:58:35 +01:00
Benno Schulenberg
5d496b3152 syntax: po: colorize also the Python-specific conversion specifier "%r" 2025-02-16 09:44:18 +01:00
Benno Schulenberg
f5a2b8983d syntax: groff: highlight the zeroeth macro argument too
It is used in some .tmac files.
2025-02-15 17:47:20 +01:00
Benno Schulenberg
0694c616a2 syntax: man: highlight some escapes, like \& and \(em, specially
This helps prevent reading things like \e and \(em as text.
2025-02-14 16:42:45 +01:00
Benno Schulenberg
1a150bf544 syntax: po: colorize also the %llu and %hhi format specifiers
And colorize %% only by itself, not combined with anything.
2025-02-10 11:04:06 +01:00
Benno Schulenberg
e26cdd3dab tweaks: remove three redundant pairs of parentheses from a nanorc regex 2025-01-12 12:32:27 +01:00
Benno Schulenberg
f04c1a6ab5 syntax: markdown: accept also digit 0 in a list marker
For ordered lists, 10., 20., 30., ... were not getting colorized.

Also, https://daringfireball.net/projects/markdown/dingus
accepts 0. by itself just fine as marker.

This addresses https://savannah.gnu.org/patch/?10492.
2024-12-15 11:39:06 +01:00
LIU Hao
07a92c3988 syntax: asm: add end-of-word anchors to the keywords
Previously some of these regexes could color part of a directive;
for example, the `.int` part of `.intel_syntax`.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-05 17:12:25 +01:00
Benno Schulenberg
2fca581095 syntax: groff: correct the mistaken .rof extension to .roff
Buglet existed since version 2.9.8, commit cdd637d6.
2024-10-23 11:14:48 +02:00
Benno Schulenberg
53afd90ad4 syntax: groff: recognize also the .mom extension
This addresses https://savannah.gnu.org/bugs/?66369.
Reported-by: Elfener <elfenermarcell@gmail.com>
2024-10-23 11:07:05 +02:00
Benno Schulenberg
1862995aab syntax: spec: colorize all canonical architecture names
The list of canonical names was found in:
  https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in

The canonical names were extracted with:

  grep arch_canon rpmrc.in | sed 's/^.*:\s*//' | sed 's/\s*..\?$//'

and then sorted and condensed into a regular expression.

Inspired-by: Funda Wang <fundawang@gmail.com>
2024-09-22 12:34:28 +02:00
Benno Schulenberg
468613c9db syntax: makefile: colorize also multiple targets
Multiple targets are separated by spaces.  Furthermore, there
may be spaces before the first target and before the colon.
2024-09-06 13:56:56 +02:00
Benno Schulenberg
7e8ee46c09 syntax: autoconf: colorize the keywords 'case', 'esac', and 'ifelse' too
Case statements occur a lot in gnulib's m4 files,
and 'ifelse' is simply part of the m4 language.
2024-08-28 17:12:17 +02:00
Benno Schulenberg
109386dfe8 syntax: nanorc: an unquoted argument of 'include' may not contain blanks
Anything after the first "word" after 'include' will be ignored
and should thus remain colorized in bright red.
2024-08-16 15:49:28 +02:00
Benno Schulenberg
c5a0e6b60c syntax: awk: colorize escape sequences specially 2024-07-21 14:32:56 +02:00
Benno Schulenberg
d7e8665782 syntax: awk: rewrite a regex more densely, and add the missing ~ operator
Also, improve the comment.
2024-07-18 16:14:25 +02:00
Benno Schulenberg
7c86c1a185 syntax: awk: add a missing "|" between "\?" and ":"
The "\?" and ":" are meant to match the ? and : in this construct:

    condition ? thenthis : otherwisethis

The missing "|" seems to have been a typo.
2024-07-18 13:02:54 +02:00
Benno Schulenberg
f69a08fc63 syntax: man: colorize also the .MT .ME .EX .EE .SY .OP and .YS macros
Furthermore, colorize .LP .P and .PP like .TP, as paragraph macros,
instead of inconsistenly as if they specified type faces.
2024-07-15 07:48:14 +02:00
Benno Schulenberg
34dda64610 docs: explain the behavior of the new function cycle
Also colorize {cycle} when found in a nanorc file.
2024-06-15 09:57:06 +02:00
Benno Schulenberg
c70e6919c2 syntaxes: mention the original author of most of the syntax files
The names of the authors were retrieved from:

  git log -p --follow  syntax/<name>.nanorc

and from:

  git log -p --follow --all --  doc/nanorc.sample

For some files the original author is unclear, or
the file is/was too small to mention an author for.
2024-06-08 12:10:25 +02:00
Jaroslav Fowkes
abdf069ce3 syntax: fortran: fix a typo (a missing backslash)
The typo prevented several keywords from getting colorized.

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

Bug existed since version 2.1.6, commit 513157df,
since the Fortran syntax was introduced.
2024-06-07 15:34:03 +02:00
Benno Schulenberg
a1159ff484 syntax: man: colorize some of the things that manipulate hyphenation
Reference:
  https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Hyphenation.html
2024-06-06 13:29:01 +02:00
Benno Schulenberg
05602e29cd syntax: patch: recognize also the .rej extension
The addition was inspired by `davidhcefx`.
2024-06-02 17:16:22 +02:00
Benno Schulenberg
02dd0b4ed5 options: require --colonparsing/-@ to parse colon+number after a filename
Stop doing colon parsing by default, to avoid surprises and frustration
for users that have filenames that end in a colon plus digits.

The equivalent rcfile option is, of course, 'set colonparsing'.

Using +1, or similar, before the filename disables any colon parsing
and the filename is taken as is.
2024-05-25 16:48:35 +02:00
Benno Schulenberg
ce5513b009 bump version numbers and add a news item for the 8.0 release 2024-05-01 10:10:15 +02:00
Benno Schulenberg
d53521a631 syntax: sh: recognize more shells than sh on a shebang line for busybox
Also, elide an unneeded pair of parentheses.

Original-patch-by: Sertonix <sertonix@posteo.net>
  https://lists.gnu.org/archive/html/nano-devel/2024-04/msg00026.html
2024-04-22 10:29:02 +02:00
Benno Schulenberg
c02aec557c syntax: makefile, sh: recognize also a fresh Makefile and fresh .profile
When opening a nonexistent file with nano, it likely consists of only a
name without any path component, and thus without any slash.  So when a
file regex checks for a slash, it should check also for start-of-string.

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

Problem existed for the Makefile since version 2.9.8, commit 22663f8a,
and for .profile since version 3.0, commit 4a268678 (but earlier, nano
did not recognize .profile files at all).
2024-04-14 12:09:36 +02:00
Benno Schulenberg
829ab5e72d syntax: nanorc: colorize {toprow} and {bottomrow} for string binds 2024-04-07 15:55:38 +02:00
Benno Schulenberg
f1a04f780a syntax: javascript: recognize also the .mjs extension
The V8 JavaScript-engine developers recommend using this extension:
  https://v8.dev/features/modules#mjs

Also, add the fairly new "JavaScript source" as magic description.

This fulfills https://savannah.gnu.org/bugs/?65334.
Requested-by: Matt Whitlock <gnu@mattwhitlock.name>
2024-02-20 17:00:48 +01:00
Benno Schulenberg
cdaa43b396 syntax: makefile: ensure that the <Tab> key always produces a tab
Making it independent from the `tabstospaces` setting.

And remove the now-redundant suggestion from the sample nanorc.
2024-02-05 17:17:37 +01:00
Benno Schulenberg
7c174a1a25 syntax: c: require a preceding blank when a line comment contains a quote
This avoids miscolorizing part of a string when it contains a URL.

This fixes https://savannah.gnu.org/bugs/?64340.
Reported-by: Yonut Smith <deanlast3@gmail.com>

Problem has existed for more than twenty years, at least since support
for multine-line regexes was added in commit 6c1e6612 in 2002.
2024-01-09 10:20:50 +01:00
Matteo Raso
c374c773ad syntax: python: colorize decorators specially
Decorators are documented at https://peps.python.org/pep-0318/.

Signed-off-by: Matteo Raso <matteo_luigi_raso@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2023-01-22 12:31:45 +01:00
Benno Schulenberg
298447e22d syntax: html: colorize specially the other two emphasizing tags too
In most cases, <em> behaves like <i> and <strong> behaves like <b>,
so it makes sense to treat all of them in the same manner.
2023-01-05 17:01:20 +01:00
Benno Schulenberg
7f772693eb tweaks: wrap overlong lines in the Tcl syntax, to make them manageable
(And also to stay within the theoretical 256-byte POSIX limit.)
2022-12-11 12:40:22 +01:00
Benno Schulenberg
972be2df04 bump version numbers and add a news item for the 7.0 release 2022-11-15 11:17:34 +01:00
Benno Schulenberg
3785f762fc syntax: nanorc: colorize valid function names plus surrounding braces 2022-08-18 09:11:49 +02:00
Benno Schulenberg
1d10ee71bf syntax: python: mention an alternative linter in a comment 2022-07-26 12:28:49 +02:00
Benno Schulenberg
0520cbdccb syntax: perl: add missing keywords, and reduce the length of some lines
Also, compact the keywords less, so that things are easier to read.
2022-07-25 15:53:03 +02:00
Benno Schulenberg
3d3270c1b2 tweaks: put each regex on separate line, to better show many keywords
(The long list of keywords was divided over five separate regexes to
avoid exceeding the possible limit of 256 bytes/characters per regex.)
2022-07-25 14:48:40 +02:00