Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#982091: Please include more syntax highlight configs in nano, yaml.nanorc in particular

137 views
Skip to first unread message

Otto Kekäläinen

unread,
Feb 6, 2021, 9:10:04 AM2/6/21
to
Package: nano
Version: 5.1-1
Severity: wishlist

Currently nano itself nor any additional package of it ships yaml.nanorc:
https://packages.debian.org/search?mode=path&suite=sid&section=all&arch=any&searchon=contents&keywords=yaml.nanorc

.yml files are quite common, and it would be nice if nano showed
syntax highlightning for them by default.

Personally I have been using the file from
https://rpanev.pro/linux/ansible/2020/02/14/How-to-enable-syntax-highlighting-for-YAML-files-in-Nano.html

Here is a huge collection of configs in case you could extend the
collection that nano in Debian ships:
https://github.com/serialhex/nano-highlight


- Otto

Benno Schulenberg

unread,
Feb 8, 2021, 11:10:04 AM2/8/21
to

Op 06-02-2021 om 14:59 schreef Otto Kekäläinen:
> .yml files are quite common, and it would be nice if nano showed
> syntax highlightning for them by default.

On my personal machine:

$ locate -r "\.ya\?ml$" | wc -l
74

$ locate -r "\.json$" | wc -l
93

Yaml files seem less common than JSON file, but common enough to
deserve a nanorc file incorporated into nano.
That file is identical to the one from the repo you linked to:

> https://github.com/serialhex/nano-highlight

But it's unclear what license covers the file -- the site says nothing
about the yaml.nanorc. Looking at the history of the file, it seems
that it was contributed by Denis Efremov (efremov dot a dot denis (at)
gmail dot com). If you wish this yaml.nanorc to be included in nano,
please ask him if he will license this file under GPL v3+. (When you
do so, please CC me.) Or provide a file that you have designed yourself.

Benno

signature.asc

Benno Schulenberg

unread,
Sep 25, 2021, 8:40:03 AM9/25/21
to

Op 08-02-2021 om 16:46 schreef Benno Schulenberg:
> But it's unclear what license covers the file -- the site says nothing
> about the yaml.nanorc.

I mailed the author but did not get a response. So this morning I
constructed my own yaml.nanorc file -- see attached.

What I'm quite pleased with is that the keys in this construct:

[key1, key2]: [value1, value2]

will get colored as keys (which Vim and Emacs don't do).

Please try the syntax out and see if you have any comments.

Benno
yaml.nanorc
OpenPGP_signature

Otto Kekäläinen

unread,
Sep 26, 2021, 8:40:03 PM9/26/21
to
Hello!

I tested this today, but unfortunately the yaml.nanorc seems to have
syntax errors:

```
Error in /usr/share/nano/yaml.nanorc on line 6: A syntax name must be quoted
Error in /usr/share/nano/yaml.nanorc on line 7: A 'header' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 9: Command "tabgives" not
allowed in included file
Error in /usr/share/nano/yaml.nanorc on line 10: A 'comment' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 13: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 14: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 15: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 18: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 19: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 20: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 21: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 24: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 27: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 28: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 31: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 32: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 35: A 'color' command
requires a preceding 'syntax' command
Error in /usr/share/nano/yaml.nanorc on line 38: A 'color' command
requires a preceding 'syntax' command
```

Benno Schulenberg

unread,
Sep 27, 2021, 6:00:06 AM9/27/21
to

Op 27-09-2021 om 02:22 schreef Otto Kekäläinen:
> I tested this today, but unfortunately the yaml.nanorc seems to have
> syntax errors:
>
> Error in /usr/share/nano/yaml.nanorc on line 6: A syntax name must be quoted

The syntax file is from git, so it is meant for a modern nano (5.0 or later).

Attached is a version that should work on older nanos (but shows too much
bold and some other colors than the intended ones, and is fully readable
only on a terminal with a dark background).

Benno
yaml.nanorc
OpenPGP_signature

Benno Schulenberg

unread,
Sep 30, 2021, 11:10:05 AM9/30/21
to

Sorry, that was my Yaml test file (all the Yaml fragments from
the Wikipedia article).

Correct file is attached now.

Benno

yaml.nanorc
OpenPGP_signature
0 new messages