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
## Syntax highlighting for YAML files.

## Original author:  Benno Schulenberg
## License:  GPL version 3 or newer

syntax yaml "\.ya?ml$"
header "^---"

tabgives "  "
comment "#"

# Keys:
color green "\<[[:alnum:]_-]+:( |$)"
color green "\[[[:alnum:]_-, ]+\]:( |$)"
color normal ": "

# Booleans, numbers, strings:
color lightmagenta ": 
+(Y(es)?|No?|y(es)?|no?|[Tt]rue|[Ff]alse|[Oo](n|ff))(\]|\}|, | |$)"
color lightmagenta " [+-]?[0-9]+(\.[0-9]+)?(\]|\}|, | |$)"
color lightmagenta "("[^"]+"|'[^']+')"
color normal ", "

# Anchors and references:
color pink "(&|\*)[[:alnum:]]+( |$)"

# Symbols:
color bold,lagoon "^(---|\.\.\.)( |$)" " [|>](\+|-)?$"
color yellow "(^ *- |[]{}[])"

# Types:
color mint " !!(binary|bool|float|int|map|null|omap|seq|set|str)( |$)"
color lime " ![[:alnum:]_-]+( |$)"

# Missing space, trailing space, or tabs:
color ,red ":[^ ]| *$|  "

# Comments:
color italic,cyan "(^| +)#.*"

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to