From 0b7767e36797dd86b60484b24e480daaad086da0 Mon Sep 17 00:00:00 2001 From: Benjamin Wolff Date: Sat, 17 May 2025 15:09:39 +0200 Subject: [PATCH] working implementation --- lua/overseer/binding_util.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/overseer/binding_util.lua b/lua/overseer/binding_util.lua index 78c94e5c..9cd36ea6 100644 --- a/lua/overseer/binding_util.lua +++ b/lua/overseer/binding_util.lua @@ -71,7 +71,11 @@ M.show_bindings = function(prefix) local bindings_to_plug = {} local highlights = {} + local close_bindings = {} for plug, bindings in pairs(plug_to_bindings) do + if vim.endswith(plug, ":Close") or vim.endswith(plug, ":Cancel") then + vim.list_extend(close_bindings, bindings) + end local binding_str = table.concat(bindings, "/") bindings_to_plug[binding_str] = plug local hl = {} @@ -108,8 +112,13 @@ M.show_bindings = function(prefix) }) end end - vim.keymap.set("n", "q", "close", { buffer = bufnr }) - vim.keymap.set("n", "", "close", { buffer = bufnr }) + + if #close_bindings == 0 then + close_bindings = { "q", "" } + end + for _, b in ipairs(close_bindings) do + vim.keymap.set("n", b, "close", { buffer = bufnr }) + end vim.bo[bufnr].modifiable = false vim.bo[bufnr].bufhidden = "wipe"