From 97bb3e55aa59ab4e5a200da42f2df08f83b5894b Mon Sep 17 00:00:00 2001 From: Duncan Lock Date: Thu, 7 Oct 2021 21:20:21 -0700 Subject: [PATCH] Add .ini file syntax highlighting --- plugins/language_ini.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/language_ini.lua diff --git a/plugins/language_ini.lua b/plugins/language_ini.lua new file mode 100644 index 00000000..f106a57a --- /dev/null +++ b/plugins/language_ini.lua @@ -0,0 +1,26 @@ +-- mod-version:2 + +local syntax = require "core.syntax" + +syntax.add { + files = { "%.ini$", "%.inf$", "%.cfg$", "%.editorconfig$" }, + comment = ';', + patterns = { + { pattern = ";.-\n", type = "comment" }, + { pattern = "#.-\n", type = "comment" }, + { pattern = { "%[", "%]" }, type = "keyword" }, + + { pattern = { '"""', '"""', '\\' }, type = "string" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'''", "'''" }, type = "string" }, + { pattern = { "'", "'" }, type = "string" }, + { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" }, + { pattern = "[%-+]?[0-9_]+%.[0-9_]+", type = "number" }, + { pattern = "[%-+]?[0-9_]+", type = "number" }, + { pattern = "[a-z]+", type = "symbol" }, + }, + symbols = { + ["true"] = "literal", + ["false"] = "literal", + }, +}