aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-04-27 18:41:46 +0100
committerrxi <rxi@users.noreply.github.com>2020-04-27 18:41:46 +0100
commit3c9af5d7289fb079517df630f6d17a98657b10b7 (patch)
treefb611fd263e6f6a449a416664d7f47eddc18008e
parent8d4088542bb210459633d0afb7be15f93c3d41c8 (diff)
downloadlite-xl-plugins-3c9af5d7289fb079517df630f6d17a98657b10b7.tar.gz
lite-xl-plugins-3c9af5d7289fb079517df630f6d17a98657b10b7.zip
Added `language_sh` plugin
-rw-r--r--README.md1
-rw-r--r--plugins/language_sh.lua28
2 files changed, 29 insertions, 0 deletions
diff --git a/README.md b/README.md
index a2dc8ca..ab20204 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ Plugin | Description
[`language_php`](plugins/language_php.lua?raw=1) | Syntax for the [PHP](https://php.net) programming language
[`language_psql`](plugins/language_psql.lua?raw=1) | Syntax for the postgresql database access language
[`language_rust`](plugins/language_rust.lua?raw=1) | Syntax for the [Rust](https://rust-lang.org/) programming language
+[`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language
[`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language
[`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`sort`](plugins/sort.lua?raw=1) | Sorts selected lines alphabetically
diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua
new file mode 100644
index 0000000..e76cabc
--- /dev/null
+++ b/plugins/language_sh.lua
@@ -0,0 +1,28 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.sh$" },
+ comment = "#",
+ patterns = {
+ { pattern = "#.*\n", type = "comment" },
+ { pattern = [[\.]], type = "normal" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
+ { pattern = "[!<>|%[%]=*]", type = "operator" },
+ { pattern = "%f[%S]%-[%w%-_]+", type = "function" },
+ { pattern = "$[%a_@*][%w_]*", type = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["if"] = "keyword",
+ ["then"] = "keyword",
+ ["elif"] = "keyword",
+ ["else"] = "keyword",
+ ["fi"] = "keyword",
+ ["echo"] = "keyword",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ },
+}
+