syntax: nanorc: improve the file-matching regex

The "\.?" part was pointless.  It says that the string "nanorc"
*might* be preceded with a period.  Sure, but if the period is
absent, then anything else may be there too, so the optional
period gives zero restriction.

The restriction should be: either the filename has the extension
".nanorc" OR the full filename is "nanorc".  So the "nanorc" part
must be preceded by either a period or a slash.

(However, in the times of commits 3dc0e23e and dc9c40a5, fifteen
and eighteen years ago, it was still the user-provided filename
that was matched against the regex, not the full-path filename.
The latter method arrived in commit ec8d51be, six years ago.)
master
Benno Schulenberg 2021-10-25 09:16:19 +02:00
parent 9b419d0bff
commit e52c81f5db
1 changed files with 1 additions and 1 deletions

View File

@ -1,6 +1,6 @@
## Syntax highlighting for nanorc files.
syntax nanorc "\.?nanorc(\.in)?$"
syntax nanorc "[/.]nanorc(\.in)?$"
comment "#"
# Everything that does not get recolored is invalid