From 6944dadb1041ee8323ccbf68c40770299f67ae35 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 8 Jun 2022 07:13:24 +0200 Subject: `minimap`: allow per-`DocView` toggle even if globally disabled --- plugins/minimap.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/minimap.lua b/plugins/minimap.lua index f2638c8..7c4ddab 100644 --- a/plugins/minimap.lua +++ b/plugins/minimap.lua @@ -198,8 +198,12 @@ local function show_minimap(docview) if not docview:is(DocView) then return false end if not config.plugins.minimap.enabled - or not docview:is(DocView) - or per_docview[docview] == false + and per_docview[docview] ~= true + then + return false + elseif + config.plugins.minimap.enabled + and per_docview[docview] == false then return false end @@ -535,6 +539,7 @@ end command.add(nil, { ["minimap:toggle-visibility"] = function() config.plugins.minimap.enabled = not config.plugins.minimap.enabled + setmetatable({}, { __mode = "k" }) end, ["minimap:toggle-syntax-highlighting"] = function() config.plugins.minimap.syntax_highlight = not config.plugins.minimap.syntax_highlight @@ -543,7 +548,11 @@ command.add(nil, { command.add("core.docview!", { ["minimap:toggle-visibility-for-current-view"] = function() - per_docview[core.active_view] = per_docview[core.active_view] == false + if config.plugins.minimap.enabled then + per_docview[core.active_view] = per_docview[core.active_view] == false + else + per_docview[core.active_view] = not per_docview[core.active_view] + end end }) -- cgit v1.2.3