From 35e947d1933613bb0b5a1488bf0fa4587f98ef7d Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 24 May 2022 19:29:50 -0400 Subject: added config_spec and other plugin compatibility fixes. --- plugins/linenumbers.lua | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'plugins/linenumbers.lua') 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 -- cgit v1.2.3