which-key.nvim
which-key.nvim copied to clipboard
bug: Keys.update_keymaps only adds, never removes
Did you check docs and existing issues?
- [X] I have read all the which-key.nvim docs
- [X] I have searched the existing issues of which-key.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068
Operating system/version
Ubuntu 22.04.3 LTS
Describe the bug
When a buffer local keymap is removed, which-key will still show it as if it exists. In other words, which-key only adds buffer local keymaps to the tree, it never removes them.
Steps To Reproduce
Add the following two keymaps, the first one adds the buffer local keymap to current buffer, the second one removes it.
vim.keymap.set('n', '<leader>A', function()
vim.keymap.set('n', '<leader>aa', function()
print 'aa'
end, { buffer = vim.api.nvim_get_current_buf() })
end)
vim.keymap.set('n', '<leader>S', function()
vim.keymap.del('n', '<leader>aa', { buffer = vim.api.nvim_get_current_buf() })
end)
- Open some file like your
init.lua
. - Do
<leader>A
- Do
<leader>
and observe howa ->
appears in the which-key help window - Do
<leader>S
- Do
<leader>
and observe howa ->
still appears in the which-key help window
Expected Behavior
It is expected that in step 5
of the steps to reproduce, that we no longer see the keymap listed.
Repro
Just take any regular kickstart nvim config and add the key bindings from the `steps to reproduce`.