diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | plugins/language_fstab.lua | 98 | ||||
-rw-r--r-- | plugins/language_sh.lua | 2 | ||||
-rw-r--r-- | plugins/language_ssh_config.lua | 58 | ||||
-rw-r--r-- | plugins/spellcheck.lua | 2 | ||||
-rw-r--r-- | plugins/statusclock.lua | 54 |
6 files changed, 215 insertions, 2 deletions
@@ -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 @@ -90,6 +91,7 @@ Plugin | Description [`language_ruby`](plugins/language_ruby.lua?raw=1) | Syntax for the [Ruby](https://www.ruby-lang.org/) programming language [`language sass`](plugins/language_sass.lua?raw=1) | Syntax for the [Sass](https://sass-lang.com/) CSS preprocessor [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language +[`language_ssh_config`](plugins/language_ssh_config.lua?raw=1) | Syntax for ssh & sshd config files [`language_tcl`](plugins/language_tcl.lua?raw=1) | Syntax for the [Tcl](https://www.tcl.tk/) programming language [`language_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua. [`language_ts`](plugins/language_ts.lua?raw=1) | Syntax for the [TypeScript](https://www.typescriptlang.org/) programming language, a typed dialect of JavaScript. @@ -129,6 +131,7 @@ Plugin | Description *[`smoothcaret`](plugins/smoothcaret.lua?raw=1)* | Smooth caret animation *([gif](https://user-images.githubusercontent.com/20792268/139006049-a0ba6559-88cb-49a7-8077-4822445b4a1f.gif))* [`sort`](plugins/sort.lua?raw=1) | Sorts selected lines alphabetically [`spellcheck`](plugins/spellcheck.lua?raw=1) | Underlines misspelt words *([screenshot](https://user-images.githubusercontent.com/3920290/79923973-9caa7400-842e-11ea-85d4-7a196a91ca50.png))* *— note: on Windows a [`words.txt`](https://github.com/dwyl/english-words/blob/master/words.txt) dictionary file must be placed beside the exe* +[`statusclock`](plugins/statusclock.lua?raw=1) | Displays the current date and time in the corner of the status view [`tabnumbers`](plugins/tabnumbers.lua?raw=1) | Displays tab numbers from 1–9 next to their names *([screenshot](https://user-images.githubusercontent.com/16415678/101285362-007a8500-37e5-11eb-869b-c10eb9d9d902.png)) [`texcompile`](plugins/texcompile.lua?raw=1) | Compile Tex files into PDF [`theme16`](https://github.com/monolifed/theme16)* | Theme manager with base16 themes 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", + }, +} diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua index 9159f3b..a44b212 100644 --- a/plugins/language_sh.lua +++ b/plugins/language_sh.lua @@ -9,6 +9,7 @@ syntax.add { -- $# is a bash special variable and the '#' shouldn't be interpreted -- as a comment. { pattern = "$[%a_@*#][%w_]*", type = "keyword2" }, + { pattern = "${.-}", type = "keyword2" }, { pattern = "#.*\n", type = "comment" }, { pattern = [[\.]], type = "normal" }, { pattern = { '"', '"', '\\' }, type = "string" }, @@ -17,7 +18,6 @@ syntax.add { { pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" }, { pattern = "[!<>|&%[%]=*]", type = "operator" }, { pattern = "%f[%S]%-[%w%-_]+", type = "function" }, - { pattern = "${.-}", type = "keyword2" }, { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { diff --git a/plugins/language_ssh_config.lua b/plugins/language_ssh_config.lua new file mode 100644 index 0000000..666f3f3 --- /dev/null +++ b/plugins/language_ssh_config.lua @@ -0,0 +1,58 @@ +-- mod-version:2 -- lite-xl 2.0 +local syntax = require "core.syntax" + +syntax.add { + files = { "sshd?/?_?config$" }, + comment = '#', + patterns = { + { pattern = "#.*\n", type = "comment" }, + { pattern = "%d+", type = "number" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = "@", type = "operator" }, + }, + symbols = { + -- ssh config + ["Host"] = "function", + ["ProxyCommand"] = "function", + + ["HostName"] = "keyword", + ["IdentityFile"] = "keyword", + ["IdentitiesOnly"] = "keyword", + ["User"] = "keyword", + ["Port"] = "keyword", + + ["ForwardAgent"] = "keyword", + ["ForwardX11"] = "keyword", + ["ForwardX11Trusted"] = "keyword", + ["HostbasedAuthentication"] = "keyword", + ["GSSAPIAuthentication"] = "keyword", + ["GSSAPIDelegateCredentials"] = "keyword", + ["GSSAPIKeyExchange"] = "keyword", + ["GSSAPITrustDNS"] = "keyword", + ["BatchMode"] = "keyword", + ["CheckHostIP"] = "keyword", + ["AddressFamily"] = "keyword", + ["ConnectTimeout"] = "keyword", + ["StrictHostKeyChecking"] = "keyword", + ["Ciphers"] = "keyword", + ["MACs"] = "keyword", + ["EscapeChar"] = "keyword", + ["Tunnel"] = "keyword", + ["TunnelDevice"] = "keyword", + ["PermitLocalCommand"] = "keyword", + ["VisualHostKey"] = "keyword", + ["RekeyLimit"] = "keyword", + ["SendEnv"] = "keyword", + ["HashKnownHosts"] = "keyword", + ["GSSAPIAuthentication"] = "keyword", + + -- sshd config + ["Subsystem"] = "keyword2", + + + ["yes"] = "literal", + ["no"] = "literal", + ["any"] = "literal", + ["ask"] = "literal", + }, +} diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua index db58606..7b0ba2b 100644 --- a/plugins/spellcheck.lua +++ b/plugins/spellcheck.lua @@ -8,7 +8,7 @@ local DocView = require "core.docview" local Doc = require "core.doc" config.plugins.spellcheck = {} -config.spellcheck.files = { "%.txt$", "%.md$", "%.markdown$" } +config.plugins.spellcheck.files = { "%.txt$", "%.md$", "%.markdown$" } if PLATFORM == "Windows" then config.plugins.spellcheck.dictionary_file = EXEDIR .. "/words.txt" else diff --git a/plugins/statusclock.lua b/plugins/statusclock.lua new file mode 100644 index 0000000..8289502 --- /dev/null +++ b/plugins/statusclock.lua @@ -0,0 +1,54 @@ +-- mod-version:2 -- lite-xl 2.0 +local core = require "core" +local config = require "core.config" +local style = require "core.style" +local StatusView = require "core.statusview" +local scan_rate = 1 + +config.plugins.statusclock = { + time_format = "%H:%M:%S", + date_format = "%A, %d %B %Y" +} + +local time_data = { + time_text = '', + date_text = '', +} + +core.add_thread(function() + while true do + local time_text = os.date(config.plugins.statusclock.time_format) + local date_text = os.date(config.plugins.statusclock.date_format) + + if time_data.time_text ~= time_text or time_data.time_text ~= date_text then + core.redraw = true + time_data.time_text = time_text + time_data.date_text = date_text + end + + coroutine.yield(scan_rate) + end +end) + +local get_items = StatusView.get_items + +function StatusView:get_items() + local left, right = get_items(self) + + local t = { + style.dim, + self.separator, + style.dim and style.text, + time_data.date_text, + style.dim, + self.separator, + style.dim and style.text, + time_data.time_text, + } + for _, item in ipairs(t) do + table.insert(right, item) + end + + return left, right +end + |