diff options
author | Jefferson González <jgmdev@gmail.com> | 2021-07-07 18:49:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 18:49:31 -0400 |
commit | e26ba1e9d2bf441ed0a24521cbe1b2dfd0bfc099 (patch) | |
tree | 598e6baac93785b2f8299b66ff6ff9fc194037c4 | |
parent | 0d706ddd861b471bb4f148d119bc990adadabb05 (diff) | |
parent | 261a20db99b0152f8baba7ea16272aa2559ec325 (diff) | |
download | lite-xl-plugins-e26ba1e9d2bf441ed0a24521cbe1b2dfd0bfc099.tar.gz lite-xl-plugins-e26ba1e9d2bf441ed0a24521cbe1b2dfd0bfc099.zip |
Merge pull request #43 from jgmdev/language-yaml
Added Language yaml
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_yaml.lua | 57 |
2 files changed, 58 insertions, 0 deletions
@@ -88,6 +88,7 @@ Plugin | Description [`language_tsx`](plugins/language_tsx.lua?raw=1) | Syntax for [TSX](https://www.typescriptlang.org/docs/handbook/jsx.html) language [`language_v`](plugins/language_v.lua?raw=1) | Syntax for the [V](https://vlang.io/) programming language [`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language +[`language_yaml`](plugins/language_yaml.lua?raw=1) | Syntax for [YAML](https://yaml.org/) serialization language [`language_zig`](plugins/language_zig.lua?raw=1) | Syntax for the [Zig](https://ziglang.org/) programming language ~~[`lastproject`](plugins/lastproject.lua?raw=1)~~ | Integrated with lite-xl ~~Loads the last loaded project if lite is launched without any arguments~~ [`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline diff --git a/plugins/language_yaml.lua b/plugins/language_yaml.lua new file mode 100644 index 0000000..40e19b6 --- /dev/null +++ b/plugins/language_yaml.lua @@ -0,0 +1,57 @@ +-- mod-version:1 -- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = { "%.yml$", "%.yaml$" }, + comment = "#", + patterns = { + { pattern = { "#", "\n"}, type = "comment" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "%-?%.inf", type = "number" }, + { pattern = "%.NaN", type = "number" }, + { + pattern = "%&()%g+", + type = { "keyword", "literal" } + }, + { pattern = "!%g+", type = "keyword" }, + { pattern = "<<", type = "literal" }, + { + pattern = "[%s]%*()[%w%d_]+", + type = { "keyword", "keyword2" } + }, + { + pattern = "%*()[%w%d_]+", + type = { "keyword", "literal" } + }, + { + pattern = "[%[%{]()%s*[%w%d]+%g+%s*():%s", + type = { "operator", "keyword2", "operator" } + }, + { + pattern = "[%s][%w%d]+%g+%s*():%s", + type = { "keyword2", "operator" } + }, + { + pattern = "[%w%d]+%g+%s*():%s", + type = { "literal", "operator" } + }, + { pattern = "0%d+", type = "number" }, + { pattern = "0x%x+", type = "number" }, + { pattern = "[%+%-]?%d+[,%.eE:%+%d]*%d+", type = "number" }, + { pattern = "[%*%|%!>%%]", type = "keyword" }, + { pattern = "[%-:%?%*%{%}%[%]]", type = "operator" }, + -- Everything else for keywords to work + { + pattern = "[%d%a_][%g_]*()[%]%},]", + type = { "string", "operator" } + }, + { pattern = "[%d%a_][%g_]*", type = "string" }, + }, + symbols = { + ["true"] = "number", + ["false"] = "number", + ["y"] = "number", + ["n"] = "number" + } +} |