💥 Create key bindings that stick. WhichKey is a lua plugin for Neovim 0.5 that displays a popup with possible keybindings of the command you started typing.
[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)
0.9.1
Operating system/version
Arch Linux
Describe the bug
I have bound the hjkl keys for different purposes. While which-key correctly displays the popup for h and l, it does not do so for j and k. I assume this may be related to the triggers_blacklist setting, so I added the following to my config:
{
triggers_blacklist = {
n = {},
i = {},
v = {},
}
}
This does not seem to have an effect. I assume this may be because this setting is merged with the default rather than overwriting it.
Steps To Reproduce
Set the config to
{
'folke/which-key.nvim',
event = 'VeryLazy',
opts = {
triggers_blacklist = {
n = {},
i = {},
v = {},
}
},
}
Add some example j and k keybindings and disable the default motions:
vim.keymap.set('n', 'jj', function() print('Hello from j') end, { desc = 'Say hello from j' })
vim.keymap.set('n', 'kk', function() print('Hello from k') end, { desc = 'Say hello from k' })
vim.keymap.set('n', 'j', '<nop>')
vim.keymap.set('n', 'k', '<nop>')
Press j or k and see that the which-key does not appear.
Expected Behavior
The which-key window appears when pressing j or k.
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"folke/which-key.nvim",
opts = {
triggers_blacklist = {
n = {},
i = {},
v = {},
}
}
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- Add keymaps
vim.keymap.set('n', 'jj', function() print('Hello from j') end, { desc = 'Say hello from j' })
vim.keymap.set('n', 'kk', function() print('Hello from k') end, { desc = 'Say hello from k' })
vim.keymap.set('n', 'j', '<nop>')
vim.keymap.set('n', 'k', '<nop>')
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.1
Operating system/version
Arch Linux
Describe the bug
I have bound the
hjkl
keys for different purposes. While which-key correctly displays the popup for h and l, it does not do so for j and k. I assume this may be related to thetriggers_blacklist
setting, so I added the following to my config:This does not seem to have an effect. I assume this may be because this setting is merged with the default rather than overwriting it.
Steps To Reproduce
Set the config to
Add some example
j
andk
keybindings and disable the default motions:Press j or k and see that the which-key does not appear.
Expected Behavior
The which-key window appears when pressing j or k.
Repro