From f5457356386b2cf2716b8ce4de6c502ea7329113 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 3 Oct 2021 10:09:28 +0200 Subject: [PATCH] syntax: yaml: colorize the two known directives See https://yaml.org/spec/1.2.2/#68-directives. Also, recognize a Yaml file from a %YAML directive on the first line. --- syntax/yaml.nanorc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syntax/yaml.nanorc b/syntax/yaml.nanorc index 19118cc8..6da3cd0a 100644 --- a/syntax/yaml.nanorc +++ b/syntax/yaml.nanorc @@ -4,7 +4,7 @@ ## License: GPL version 3 or newer syntax yaml "\.ya?ml$" -header "^---( |$)" +header "^%YAML |^---( |$)" tabgives " " comment "#" @@ -26,7 +26,8 @@ color lightmagenta "("([^"]|\\")+"|'[^']+')" color pink " [&*](\w|-)+( |$)" # Symbols: -color bold,lagoon "^(---|\.\.\.)( |$)" " [|>]([1-9]?[+-]|[+-][1-9]?)?$" +color bold,lagoon "^(%YAML +[1-9]\.[0-9]$|%TAG |(---|\.\.\.)( |$))" +color bold,lagoon " [|>]([1-9]?[+-]|[+-][1-9]?)?$" color bold,yellow "^ *(\?|([?:] +)?-) " color yellow "[]{}[]" color normal "^ *: "