nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] syntax: yaml: new file -- coloring rules for YAML files


From: Benno Schulenberg
Subject: [PATCH] syntax: yaml: new file -- coloring rules for YAML files
Date: Sat, 25 Sep 2021 14:15:46 +0200

  == Work in progress; please provide feedback. ==

This fulfills https://bugs.debian.org/982091.
Requested-by: Otto Kekäläinen <otto@debian.org>
---
 syntax/yaml.nanorc | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 syntax/yaml.nanorc

diff --git a/syntax/yaml.nanorc b/syntax/yaml.nanorc
new file mode 100644
index 00000000..dd3c6a26
--- /dev/null
+++ b/syntax/yaml.nanorc
@@ -0,0 +1,38 @@
+## 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 "(^| +)#.*"
-- 
2.29.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]