which-key.nvim
which-key.nvim copied to clipboard
fix(state): recursion in hydra mode when mapping does not exist
Description
# minimal.lua
vim.g.mapleader = " "
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{ "folke/which-key.nvim", opts = {} },
-- add any other plugins here
},
})
local wk = require("which-key")
wk.add({
{
"<leader>mq",
function()
print("i am mq")
end,
},
{
"<leader>mw",
function()
print("i am mw")
end,
},
{
"<leader>mj",
"j",
},
{
"<leader>m",
function()
vim.notify("hail hydra")
require("which-key").show({
keys = "<leader>m",
loop = true, -- this will keep the popup open until you hit <esc>
})
end,
},
})
Before this pr, given the above config,
there's currently two problem:
- issuing the key
<leader>mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...., we will falsly get the recusion warning - issuing the key
<leader>mh, we end up in a recursion
Related Issue(s)
- Fixes #811
This PR is stale because it has been open 30 days with no activity.