aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--plugins/autosave.lua3
-rw-r--r--plugins/language_lobster.lua66
-rw-r--r--plugins/language_sass.lua2
-rw-r--r--plugins/language_toml.lua32
-rw-r--r--plugins/language_v.lua4
-rw-r--r--plugins/language_zig.lua5
-rw-r--r--plugins/lfautoinsert.lua1
-rw-r--r--plugins/linenumbers.lua85
-rw-r--r--plugins/smallclock.lua2
10 files changed, 198 insertions, 7 deletions
diff --git a/README.md b/README.md
index fffecad..635e58d 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
@@ -85,6 +86,7 @@ Plugin | Description
[`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.
[`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_tsx`](plugins/language_tsx.lua?raw=1) | Syntax for [TSX](https://www.typescriptlang.org/docs/handbook/jsx.html) 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
@@ -94,6 +96,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)~~ | Integrated with lite-xl ~~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`
@@ -108,8 +111,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`~~ | Integrated in lite-xl with improvements ~~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/autosave.lua b/plugins/autosave.lua
index e6fa21c..9518adf 100644
--- a/plugins/autosave.lua
+++ b/plugins/autosave.lua
@@ -2,7 +2,6 @@
local core = require "core"
local config = require "core.config"
local Doc = require "core.doc"
-local DocView = require "core.docview"
local command = require "core.command"
-- this is used to detect the wait time
local last_keypress = os.time()
@@ -42,5 +41,5 @@ function Doc:on_text_change(type)
if self.filename then
updatepress()
end
- return on_text_change(type)
+ return on_text_change(self, type)
end
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",
+ },
+}
+
diff --git a/plugins/language_sass.lua b/plugins/language_sass.lua
index 752f5b0..aa11637 100644
--- a/plugins/language_sass.lua
+++ b/plugins/language_sass.lua
@@ -2,7 +2,7 @@
local syntax = require "core.syntax"
syntax.add {
- files = { "%.sass$" },
+ files = { "%.sass$" ,"%.scss$"},
comment = "//",
patterns = {
{ pattern = "/[/%*].-\n", type = "comment" },
diff --git a/plugins/language_toml.lua b/plugins/language_toml.lua
new file mode 100644
index 0000000..9de31f9
--- /dev/null
+++ b/plugins/language_toml.lua
@@ -0,0 +1,32 @@
+-- lite-xl 1.16
+
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.toml$" },
+ comment = '#',
+ patterns = {
+ { pattern = "#.-\n", type = "comment" },
+ { pattern = { '"""', '"""', '\\' }, type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'''", "'''" }, type = "string" },
+ { pattern = { "'", "'" }, type = "string" },
+ { pattern = "[A-Za-z0-9_%.%-]+%s*%f[=]", type = "function" },
+ { pattern = "%[[A-Za-z0-9_%.%- ]+%]", type = "keyword" },
+ { pattern = "%[%[[A-Za-z0-9_%.%- ]+%]%]", type = "keyword" },
+ { pattern = "[%-+]?[0-9_]+%.[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
+ { pattern = "[%-+]?[0-9_]+%.[0-9_]+", type = "number" },
+ { pattern = "[%-+]?[0-9_]+[eE][%-+]?[0-9_]+", type = "number" },
+ { pattern = "[%-+]?[0-9_]+", type = "number" },
+ { pattern = "[%-+]?0x[0-9a-fA-F_]+", type = "number" },
+ { pattern = "[%-+]?0o[0-7_]+", type = "number" },
+ { pattern = "[%-+]?0b[01_]+", type = "number" },
+ { pattern = "[%-+]?nan", type = "number" },
+ { pattern = "[%-+]?inf", type = "number" },
+ { pattern = "[a-z]+", type = "symbol" },
+ },
+ symbols = {
+ ["true"] = "literal",
+ ["false"] = "literal",
+ },
+}
diff --git a/plugins/language_v.lua b/plugins/language_v.lua
index 526002f..774617a 100644
--- a/plugins/language_v.lua
+++ b/plugins/language_v.lua
@@ -45,8 +45,8 @@ syntax.add {
["match"] = "keyword",
["module"] = "keyword",
["mut"] = "keyword2",
- ["none"] = "keyword",
["or"] = "keyword",
+ ["pub"] = "keyword",
["return"] = "keyword",
["rlock"] = "keyword",
["select"] = "keyword",
@@ -63,7 +63,7 @@ syntax.add {
["true"] = "literal",
["false"] = "literal",
- ["pub"] = "literal",
+ ["none"] = "literal",
},
}
diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua
index 3c4f6fa..4629e89 100644
--- a/plugins/language_zig.lua
+++ b/plugins/language_zig.lua
@@ -39,6 +39,7 @@ syntax.add {
["while"] = "keyword",
["var"] = "keyword",
["anytype"] = "keyword",
+ ["anyframe"] = "keyword",
["const"] = "keyword",
["test"] = "keyword",
["packed"] = "keyword",
@@ -76,6 +77,10 @@ syntax.add {
["enum"] = "keyword",
["union"] = "keyword",
["opaque"] = "keyword",
+ ["inline"] = "keyword",
+ ["allowzero"] = "keyword",
+ ["noalias"] = "keyword",
+ ["nosuspend"] = "keyword",
-- types
["f16"] = "keyword2",
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua
index ddbec5e..5f4148b 100644
--- a/plugins/lfautoinsert.lua
+++ b/plugins/lfautoinsert.lua
@@ -13,6 +13,7 @@ config.plugins.lfautoinsert = { map = {
[":%s*\n"] = false,
["->%s*\n"] = false,
["^%s*<([^/][^%s>]*)[^>]*>%s*\n"] = "</$TEXT>",
+ ["^%s*{{#([^/][^%s}]*)[^}]*}}%s*\n"] = "{{/$TEXT}}",
["/%*%s*\n"] = "*/",
["c/c++"] = {
file_patterns = {
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
+})
diff --git a/plugins/smallclock.lua b/plugins/smallclock.lua
index 3ab9e4a..b22bc71 100644
--- a/plugins/smallclock.lua
+++ b/plugins/smallclock.lua
@@ -9,7 +9,7 @@ core.add_thread(function()
while true do
local t = os.date("*t")
time = string.format("%02d:%02d", t.hour, t.min)
- coroutine.yield()
+ coroutine.yield(1)
end
end)