From 139d90dbc1640d26981e17983f439e9f11a06617 Mon Sep 17 00:00:00 2001 From: lqdev Date: Tue, 20 Jul 2021 20:26:52 +0200 Subject: language_toml added --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index a31c13a..f7c5efe 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ Plugin | Description [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting 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_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language +[`language_toml`](plugins/language_toml.lua?raw=1) | Syntax for the [TOML](https://toml.io/en/) configuration language [`language_v`](plugins/language_v.lua?raw=1) | Syntax for the [V](https://vlang.io/) programming language [`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language [`language_zig`](plugins/language_zig.lua?raw=1) | Syntax for the [Zig](https://ziglang.org/) programming language -- cgit v1.2.3 From 661f13314d3ea05e4ccd9cfe3266def42eb41b05 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Fri, 6 Aug 2021 19:16:32 +0200 Subject: Add syntax of Lobster language --- README.md | 1 + plugins/language_lobster.lua | 66 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 plugins/language_lobster.lua (limited to 'README.md') diff --git a/README.md b/README.md index 7a40002..1844e28 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Plugin | Description [`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 [`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files [`language_liquid`](plugins/language_liquid.lua?raw=1) | Syntax for [Liquid](https://shopify.github.io/liquid/) templating language +[`language_lobster`](plugins/language_lobster.lua?raw=1) | Syntax for [Lobster](https://strlen.com/lobster/) programming language [`language_make`](plugins/language_make.lua?raw=1) | Syntax for the Make build system language [`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language [`language_moon`](plugins/language_moon.lua?raw=1) | Syntax for the [MoonScript](https://moonscript.org) scripting language diff --git a/plugins/language_lobster.lua b/plugins/language_lobster.lua new file mode 100644 index 0000000..8b4d899 --- /dev/null +++ b/plugins/language_lobster.lua @@ -0,0 +1,66 @@ +-- mod-version:1 -- lite-xl 1.16 +local syntax = require "core.syntax" + +syntax.add { + files = "%.lobster$", + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + + { pattern = "struct%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "class%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "import%s+from", type = "keyword" }, + + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { '"""', '"""' }, type = "string" }, + { pattern = "0x%x+", type = "number" }, + { pattern = "%d+[%d%.eE]*f?", type = "number" }, + { pattern = "%.?%d+f?", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["import"] = "keyword", + ["def"] = "keyword", + ["fn"] = "keyword", + ["return"] = "keyword", + ["program"] = "keyword", + ["private"] = "keyword", + ["resource"] = "keyword", + + -- not really keywords but provides control-flow constructs + ["if"] = "keyword", + ["for"] = "keyword", + ["while"] = "keyword", + ["else"] = "keyword", + + ["enum"] = "keyword", + ["enum_flags"] = "keyword", + + ["int"] = "keyword2", + ["float"] = "keyword2", + ["string"] = "keyword2", + ["any"] = "keyword2", + ["void"] = "keyword2", + + ["is"] = "keyword", + ["typeof"] = "keyword", + ["var"] = "keyword", + ["let"] = "keyword", + ["pakfile"] = "keyword", + ["switch"] = "keyword", + ["case"] = "keyword", + ["default"] = "keyword", + ["namespace"] = "keyword", + + ["not"] = "operator", + ["and"] = "operator", + ["or"] = "operator", + + ["nil"] = "literal", + }, +} + -- cgit v1.2.3 From bcfbb0c5cf7c1c087f7bc3bd37afde309322978c Mon Sep 17 00:00:00 2001 From: Timofffee Date: Mon, 16 Aug 2021 01:52:24 +0400 Subject: Add plugin --- README.md | 3 +- plugins/linenumbers.lua | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 plugins/linenumbers.lua (limited to 'README.md') diff --git a/README.md b/README.md index 1844e28..250fdfd 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Plugin | Description [`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline [`linecopypaste`](plugins/linecopypaste.lua?raw=1) | Copy, cut and paste the current line when nothing is selected [*`lineguide`*](plugins/lineguide.lua?raw=1) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))* +[`linenumbers`](plugins/linenumbers.lua?raw=1) | The ability to change the display of the line number *([screenshot](https://user-images.githubusercontent.com/5556081/129493788-6a4cbd7a-9074-4133-bab7-110ed55f18f7.png))* [`linter`](https://github.com/drmargarido/linters)* | Linters for multiple languages [`lint+`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))* [`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt` @@ -109,8 +110,8 @@ Plugin | Description ~~[`projectmanager`](plugins/projectmanager.lua?raw=1)~~ | Integrated in lite-xl with improvements ~~Save projects and load/reload them quickly~~ [`pdfview`](plugins/pdfview.lua?raw=1) | PDF preview for TeX files [`rainbowparen`](plugins/rainbowparen.lua?raw=1) | Show nesting of parentheses with rainbow colours -[`restoretabs`](plugins/restoretabs.lua?raw=1) | Keep a list of recently closed tabs, and restore the tab in order on cntrl+shift+t. [`regexreplaceplugin`](plugins/regexreplaceplugin.lua?raw=1) | Allows for you to write a regex and its replacement in one go, and live preview the results. +[`restoretabs`](plugins/restoretabs.lua?raw=1) | Keep a list of recently closed tabs, and restore the tab in order on cntrl+shift+t. *[`scale`](plugins/scale.lua?raw=1)* | Provides support for dynamically adjusting the scale of the code font / UI (`ctrl+-`, `ctrl+=`) [`scalestatus`](plugins/scalestatus.lua?raw=1) | Displays current scale (zoom) in status view (depends on scale plugin) [`selectionhighlight`](plugins/selectionhighlight.lua?raw=1) | Highlights regions of code that match the current selection *([screenshot](https://user-images.githubusercontent.com/3920290/80710883-5f597c80-8ae7-11ea-97f0-76dfacc08439.png))* diff --git a/plugins/linenumbers.lua b/plugins/linenumbers.lua new file mode 100644 index 0000000..fde0a08 --- /dev/null +++ b/plugins/linenumbers.lua @@ -0,0 +1,85 @@ +-- mod-version:1 -- lite-xl 1.16 +local config = require "core.config" +local style = require "core.style" +local DocView = require "core.docview" +local common = require "core.common" +local command = require "core.command" + +local draw = DocView.draw_line_gutter +local get_width = DocView.get_gutter_width + +function DocView:draw_line_gutter(idx, x, y, width) + if not config.line_numbers and not config.relative_line_numbers then + return + end + + if config.relative_line_numbers then + + local color = style.line_number + local local_idx = idx + local align = "right" + + local l1 = self.doc:get_selection(false) + if idx == l1 then + color = style.line_number2 + if config.line_numbers then + align = "center" + else + local_idx = 0 + end + else + local_idx = math.abs(idx - l1) + end + + -- Fix for old version (<=1.16) + if width == nil then + local gpad = style.padding.x * 2 + local gw = self:get_font():get_width(#self.doc.lines) + gpad + width = gpad and gw - gpad or gw + end + + common.draw_text( + self:get_font(), + color, local_idx, align, + x + style.padding.x, + y + self:get_line_text_y_offset(), + width, self:get_line_height() + ) + else + draw(self, idx, x, y, width) + end +end + +function DocView:get_gutter_width(...) + if not config.line_numbers and not config.relative_line_numbers then + return style.padding.x + else + return get_width(self, ...) + end +end + +command.add(nil, { + ["line-numbers:toggle"] = function() + config.line_numbers = not config.line_numbers + end, + + ["line-numbers:disable"] = function() + config.line_numbers = false + end, + + ["line-numbers:enable"] = function() + config.line_numbers = true + end, + + ["relative-line-numbers:toggle"] = function() + config.relative_line_numbers = not config.relative_line_numbers + end, + + ["relative-line-numbers:enable"] = function() + config.relative_line_numbers = true + end, + + ["relative-line-numbers:disable"] = function() + config.relative_line_numbers = false + end +}) -- cgit v1.2.3