Can keymaps be removed from which key? #975
Answered
by
Hudset
Muizzyranking
asked this question in
Q&A
-
Sometimes, keymaps are dynamically removed from my config but they still show in which key even after the keymap has been deleted. Is it possible to remove from which key as well?? |
Beta Was this translation helpful? Give feedback.
Answered by
Hudset
Jul 3, 2025
Replies: 1 comment 1 reply
-
Hi, you may have already found a way to do that, what I did to “delete” them, was simply rewriting the keymaps with the option hidde = true, and rewriting them each time I recreated them. local function delete_terminals()
local terminals = terminalFunctions.get_all(true)
for _, t in ipairs(terminals) do
pcall(function()
t:shutdown()
end)
vim.keymap.del("n", "<leader>t" .. t.id)
whichkey.add({ "<leader>t" .. t.id, hidden = true }) -- Hidde All The Terminals i created
end
end local function update_terminals()
local terminals = terminalFunctions.get_all(true)
local keymaps = {}
for _, t in ipairs(terminals) do
local id = tostring(t.id)
table.insert(keymaps, {
"<leader>t" .. id,
function()
t:toggle()
end,
desc = t.display_name,
hidden = false,
icon = {
icon = "",
},
})
end
whichkey.add(keymaps)
end I hope it helps you! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Muizzyranking
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, you may have already found a way to do that, what I did to “delete” them, was simply rewriting the keymaps with the option hidde = true, and rewriting them each time I recreated them.