aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco <francesco.bbt@gmail.com>2021-10-08 20:13:14 +0200
committerGitHub <noreply@github.com>2021-10-08 20:13:14 +0200
commit6b2518a22f46e6571e3da6050c53790d03711e55 (patch)
treefaf3656bf8a28e5bb1d01a47b51d877cdc952e3f
parent959f30770853c39a666b9fc125bbdff5464be9a2 (diff)
parentc2890cef44e4c9e7c9eb9476db77d5938ef88362 (diff)
downloadlite-xl-plugins-6b2518a22f46e6571e3da6050c53790d03711e55.tar.gz
lite-xl-plugins-6b2518a22f46e6571e3da6050c53790d03711e55.zip
Merge pull request #76 from dflock/patch-5
Add syntax highlighting for .ini files
-rw-r--r--README.md1
-rw-r--r--plugins/language_ini.lua26
2 files changed, 27 insertions, 0 deletions
diff --git a/README.md b/README.md
index f7b8f7f..5e40895 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@ Plugin | Description
[`language_go`](plugins/language_go.lua?raw=1) | Syntax for the [Go](https://golang.org/) programming language
[`language_hlsl`](plugins/language_hlsl.lua?raw=1) | Syntax for the [HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl) programming language
[`language_hs`](plugins/language_hs.lua?raw=1) | Syntax for the [Haskell](https://www.haskell.org/) programming language
+[`language_ini`](plugins/language_ini.lua?raw=1) | Syntax for [ini](https://en.wikipedia.org/wiki/INI_file) files
[`language_java`](plugins/language_java.lua?raw=1) | Syntax for the [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) programming language
[`language_jiyu`](plugins/language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language
[`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript
diff --git a/plugins/language_ini.lua b/plugins/language_ini.lua
new file mode 100644
index 0000000..f106a57
--- /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",
+ },
+}