which-key.nvim
which-key.nvim copied to clipboard
bug: which-key considers empty lazy.nvim key bindings as conflicts
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 exsiting issues of plugins related to this issue
Neovim version (nvim -v)
0.8.3
Operating system/version
macOS 13.2.1
Describe the bug
The default which-key's checkhealth behaviour displays spurious warnings about conflicting bindings, when lazy.nvim happens to bind some keys for lazy-loading. This is surprising, because I'd expect that which-key would be able to ignore those with ignore_missing
set to true as those keybindings should not have any label attached (or maybe they do, and then, perhaps, it's a problem on lazy.nvim's side).
This is related to https://github.com/folke/which-key.nvim/issues/405, but the other way around. It's nice that Lazy.nvim's keymaps with an action show up in which-key, but it would also be nice if those keymaps that do not have an action beyond lazy-loading could be automatically ignored.
Steps To Reproduce
- Use the following Lazy.nvim plugin spec:
{ 'tpope/vim-unimpaired', keys = {'[', ']'}, }, { 'folke/which-key.nvim', config = function() require'which-key'.setup{ignore_missing=true} end, },
- Run
:checkhealth which_key
You'll see:
which_key: health#which_key#check
========================================================================
## WhichKey: checking conflicting keymaps
- WARNING: conflicting keymap exists for mode **"n"**, lhs: **"]"**
- INFO: rhs: ` `
- WARNING: conflicting keymap exists for mode **"n"**, lhs: **"["**
- INFO: rhs: ` `
Expected Behavior
which-key should not report any warnings.
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",
config = function() require'which-key'.setup{ignore_missing=true} end,
},
-- add any other plugins here
{ 'tpope/vim-unimpaired',
keys = {'[', ']'},
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
hello I am very new to nvim and started using lazyvim also having this problem is there any workaround to pass this error , doing checkhealth with error upsetting
hello I am very new to nvim and started using lazyvim also having this problem is there any workaround to pass this error , doing checkhealth with error upsetting
the same issue occurs with macOS 14.1.1 and Ubuntu 22.04.3 LTS
hello I am very new to nvim and started using lazyvim also having this problem is there any workaround to pass this error , doing checkhealth with error upsetting
macOS 14.2.1
Same here too. Lazyvim and macOS 14.4.1
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
hello I am very new to nvim and started using lazyvim also having this problem is there any workaround to pass this error , doing checkhealth with error upsetting
Same on Arch Linux with NVIM v. 0.10.0
That whole healthcheck will be removed, so no worries
That whole healthcheck will be removed, so no worries
@folke does this mean that which-key won't report conflicting keymaps at all? I personally like that functionality and would love to keep it if possible 😃
hello I am very new to nvim and started using lazyvim also having this problem is there any workaround to pass this error , doing checkhealth with error upsetting
Try launching nvim -V1
and running the :checkhealth
, it should show the command after `
Allright, I've added the same health check again in v3, but with some clearer explanation of what actually was checked.
This is part of v3. For more details see https://github.com/folke/which-key.nvim/pull/624