aboutsummaryrefslogtreecommitdiff
path: root/plugins/linenumbers.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-24 19:29:50 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-24 19:29:50 -0400
commit35e947d1933613bb0b5a1488bf0fa4587f98ef7d (patch)
tree07d2515f44db03b1e865f6aef6adfd12b118890b /plugins/linenumbers.lua
parentc1f3671e2a8defbc67d1e77c72d5866f2825cdb5 (diff)
downloadlite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.tar.gz
lite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.zip
added config_spec and other plugin compatibility fixes.
Diffstat (limited to 'plugins/linenumbers.lua')
-rw-r--r--plugins/linenumbers.lua26
1 files changed, 20 insertions, 6 deletions
diff --git a/plugins/linenumbers.lua b/plugins/linenumbers.lua
index 76c691d..5cf198a 100644
--- a/plugins/linenumbers.lua
+++ b/plugins/linenumbers.lua
@@ -7,7 +7,25 @@ local command = require "core.command"
config.plugins.linenumbers = common.merge({
show = true,
- relative = false
+ relative = false,
+ -- The config specification used by the settings gui
+ config_spec = {
+ name = "Line Numbers",
+ {
+ label = "Show Numbers",
+ description = "Display or hide the line numbers.",
+ path = "show",
+ type = "toggle",
+ default = true
+ },
+ {
+ label = "Relative Line Numbers",
+ description = "Display relative line numbers starting from active line.",
+ path = "relative",
+ type = "toggle",
+ default = false
+ }
+ }
}, config.plugins.linenumbers)
local draw_line_gutter = DocView.draw_line_gutter
@@ -15,11 +33,7 @@ local get_width = DocView.get_gutter_width
function DocView:draw_line_gutter(line, x, y, width)
local lh = self:get_line_height()
- if
- not config.plugins.linenumbers.show
- and
- not config.plugins.linenumbers.relative
- then
+ if not config.plugins.linenumbers.show then
return lh
end