Re: [PATCH] syntax: add highlighting for TOML files
Benno Schulenberg <[email protected]> Sun, 22 Feb 2026 11:29:51 +0100
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
Op 22-02-2026 om 07:12 schreef Vincent Yang:
> syntax/toml.nanorc | 33 +++++++++++++++++++++++++++++++++
The commit message should contain a Signed-off-by line.
And preferably a URL that refers to the TOML spec.
On my system there are nine .toml files. Six in git repos,
and three in a custom package. In other words, TOML files
do not seem to occur in a standard Linux install, so a syntax
for TOML is not a candidate for inclusion in nano.
> +syntax toml "\.toml$" "Cargo\.lock$"
Why the Cargo.lock? The two Cargo.lock files on my system say
that they are automatically generated and should not be edited.
So it might be better to not colorize them, to not give the
impression that they are regular TOML files?
> +magic "TOML"
When I run `file` on an example TOML file, it just says:
xx.toml: ASCII text
Where did you find that `file` can produce "TOML" as answer?
> +color magenta "\<[0-9]+(\.[0-9]+)?\>"
> +color brightgreen "\<(true|false)\>"
> +color magenta "\<[0-9]{4}-[0-9]{2}-[0-9]{2}\>"
Magenta is a rather dark color -- not a good choice in my opinion.
> +# Keys and Assignments
> +color brightcyan "^[[:space:]]*[^= ]+"
This causes the strings "alpha" and "omega" in the example file from
https://en.wikipedia.org/wiki/TOML to be shown in bold light cyan.
That doesn't look right.
Also, I find the brightcyan far too "loud" for the keys. It distracts
from the subsequent values.
> +color brightwhite " = "
This works on a dark background, but makes the equal signs invisible
on a light background.
> +# Table Headers (The [sections])
> +color brightmagenta "^[[:space:]]*\[+[^]]+\]+"
> +# This overpaints the brackets in the header to be white
> +color brightwhite "^[[:space:]]*\[+|\]+[[:space:]]*$"
When wanting to restore characters back to the normal foreground color,
use the color keyword "normal".
> +# Comments
> +color blue "^[[:space:]]*#.*"
Same as for magenta: too dark.
Benno
OpenPGP_signature.asc
(application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmma2p8FAwAAAAAACgkQUUu+Lrjhlh/h aQ//ckxlZAk5uXjDt5Geci2bQ32jGcfNn5zOuBp3teu+qUVlNVC5mlQ4zb5I4XJfuPpM29gkbsY7 fIJOBxMOejE/ROJPnfbexGVn+ewgRTgoCvUi4Aenp43gvjMmSlLeC7m2ZG8D6+Rld/9DDJ5O6NAd V0+6KVldk8V6zmzdkaUZlzIm6tisvK81vKlq73mqbF1aNd0N3kCVYf1KnNeQTYijFQgqEdYU5i0U Y8cyf0Z7VylXh4hMfBeXvGPFG5ufdTW998+TJkTYI+k70CVJu6r7HdFAdufsdZJN+zpsRtEqKnNu UZSdip5r5Z7yQt7EdRn1g/3ZyIgWidJY6zIDp64IDDXWYt7DXa3kBRHcEBum3SanxrjF3MmjHkjD fN3mTE5gjsbrwkUs0ckzlY0+evsdvL7NTMLryKKdBHMzOb6qqKpcgiaVsaifgfnkHGl1b33AiYht CQN+Wi9J8CPJ9rZB4fBaDuN26rLpUzWunxC1hCYueOxav7WPe2AVK+lU5jc7WcNRmcEeL8QW1dxT hxyy5Jnpi6WXhuk++XafM60u8uBrvjO5lqzN2B3JZrmUAZ5ORQzZm31RP78bevrYFVbxJ+DiHc8C Vhd9TP2YIhBtiFBXV2ZAjEFIaKV8juMVVCryhOZXk15ZBsFl8qqa1rej0wwmQ2KJGCn8KGoCxNPP x/A= =MJ7y -----END PGP SIGNATURE-----