aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Lock <duncan.lock@gmail.com>2021-11-16 20:23:17 -0800
committerGitHub <noreply@github.com>2021-11-17 12:23:17 +0800
commitf7eddec42e0ef89d391c8513cb1d73676cf9ae13 (patch)
tree118a0849555281a5f07ab08e2c21a132570210fa
parent07ab38f038cfde37fe3c7011f07b72fb92c359b1 (diff)
downloadlite-xl-plugins-f7eddec42e0ef89d391c8513cb1d73676cf9ae13.tar.gz
lite-xl-plugins-f7eddec42e0ef89d391c8513cb1d73676cf9ae13.zip
Add syntax highlighting for /etc/fstab files (#84)
* Add syntax highlighting for fstab files * Add fstab to README
-rw-r--r--README.md1
-rw-r--r--plugins/language_fstab.lua98
2 files changed, 99 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2426b0d..6647e2a 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,7 @@ Plugin | Description
[`language_elm`](plugins/language_elm.lua?raw=1) | Syntax for the [Elm](https://elm-lang.org) programming language
[`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language
[`language_fennel`](plugins/language_fennel.lua?raw=1) | Syntax for the [fennel](https://fennel-lang.org) programming language
+[`language_fstab`](plugins/language_fstab.lua?raw=1) | Syntax for the [fstab](https://en.wikipedia.org/wiki/Fstab) config files
[`language_gdscript`](plugins/language_gdscript.lua?raw=1) | Syntax for the [Godot Engine](https://godotengine.org/)'s GDScript scripting language
[`language_glsl`](plugins/language_glsl.lua?raw=1) | Syntax for the [GLSL](https://www.khronos.org/registry/OpenGL/specs/gl/) programming language
[`language_go`](plugins/language_go.lua?raw=1) | Syntax for the [Go](https://golang.org/) programming language
diff --git a/plugins/language_fstab.lua b/plugins/language_fstab.lua
new file mode 100644
index 0000000..ad10881
--- /dev/null
+++ b/plugins/language_fstab.lua
@@ -0,0 +1,98 @@
+-- mod-version:2
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "fstab" },
+ comment = '#',
+ patterns = {
+ -- Only lines that start with a # are comments; you can have #'s in fuse
+ -- filesystem strings that aren't comments, so shouldn't be highlighted as such.
+ { regex = "^#.*$", type = "comment" },
+ { pattern = "[=/:.,]+", type = "operator" },
+ { pattern = "/.*/", type = "string" },
+ { pattern = "#", type = "operator" },
+ -- {
+ -- pattern = "%g+%s+()%g+%s+()%g+%s+()%g+%s+()[01]%s+()[012]%s*",
+ -- type = {
+ -- -- filesystem
+ -- "keyword",
+ -- -- mount point
+ -- "keyword2",
+ -- -- fs type
+ -- "symbol",
+ -- -- options
+ -- "keyword2",
+ -- -- dump frequency
+ -- "keyword",
+ -- -- pass number
+ -- "keyword2",
+ -- }
+ -- },
+
+ -- UUID
+ { pattern = "%w-%-%w-%-%w-%-%w-%-%w- ", type = "string" },
+ -- IPv4 Address
+ { pattern = "%d+%.%d+%.%d+%.%d+", type = "string" },
+
+ { pattern = " %d+ ", type = "number" },
+ { pattern = "[%w_]+", type = "symbol" },
+
+ },
+ symbols = {
+ ["none"] = "literal",
+
+ ["LABEL"] = "keyword",
+ ["UUID"] = "keyword",
+
+ -- filesystems
+ ["aufs"] = "keyword2",
+ ["autofs"] = "keyword2",
+ ["bdev"] = "keyword2",
+ ["binder"] = "keyword2",
+ ["binfmt_misc"] = "keyword2",
+ ["bpf"] = "keyword2",
+ ["btrfs"] = "keyword2",
+ ["cgroup"] = "keyword2",
+ ["cgroup2"] = "keyword2",
+ ["configfs"] = "keyword2",
+ ["cpuset"] = "keyword2",
+ ["debugfs"] = "keyword2",
+ ["devpts"] = "keyword2",
+ ["devtmpfs"] = "keyword2",
+ ["ecryptfs"] = "keyword2",
+ ["ext2"] = "keyword2",
+ ["ext3"] = "keyword2",
+ ["ext4"] = "keyword2",
+ ["fuse"] = "keyword2",
+ ["fuseblk"] = "keyword2",
+ ["fusectl"] = "keyword2",
+ ["hfs"] = "keyword2",
+ ["hfsplus"] = "keyword2",
+ ["hugetlbfs"] = "keyword2",
+ ["jfs"] = "keyword2",
+ ["minix"] = "keyword2",
+ ["mqueue"] = "keyword2",
+ ["msdos"] = "keyword2",
+ ["nfs"] = "keyword2",
+ ["nfs4"] = "keyword2",
+ ["nfsd"] = "keyword2",
+ ["ntfs"] = "keyword2",
+ ["pipefs"] = "keyword2",
+ ["proc"] = "keyword2",
+ ["pstore"] = "keyword2",
+ ["qnx4"] = "keyword2",
+ ["ramfs"] = "keyword2",
+ ["rpc_pipefs"] = "keyword2",
+ ["securityfs"] = "keyword2",
+ ["sockfs"] = "keyword2",
+ ["squashfs"] = "keyword2",
+ ["swap"] = "keyword2",
+ ["sysfs"] = "keyword2",
+ ["tmpfs"] = "keyword2",
+ ["tracefs"] = "keyword2",
+ ["ufs"] = "keyword2",
+ ["vfat"] = "keyword2",
+ ["xfs"] = "keyword2",
+ },
+}