Closed MarcoBuess closed 3 months ago
This comment gave the right hint. I made to following updates to my bindings:
M.wk_register_n = {
f = { "[F]ind" },
c = { name = "[C]ode" },
w = { "[W]orkplace" },
t = {
name = "[T]erminal",
s = { "[S]end" },
},
}
M.wk_register_v = {
t = {
name = "[T]erminal",
s = { "[S]end" },
},
}
and updated my spec like so:
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
plugins = {
spelling = { enabled = true },
},
},
config = function()
require("which-key").register({ require("config.keymaps").wk_register_n },
{ mode = "n", prefix = "<leader>" })
require("which-key").register({ require("config.keymaps").wk_register_v },
{ mode = "v", prefix = "<leader>" })
end
}
Labels are now showing as expected. Is this how I'm supposed to do this?
For some reason it is more consistent if you're binding without explicit prefix but rather using ["<leader>"]
directly in the binding. Then if setting mode { "n", "v" }
it's binding in both modes as expected. I guess thats why it is also done this way in LazyVim
?
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.
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.1
Operating system/version
Windows 10 (10.0.19045)
Describe the bug
Given the following mappings:
and the following set of keybindings:
The normal mode mappings will work fine. Once I have a visual selection and trigger which-key with
<leader>
the labels fort
don't get applied. They will show but only with the name+prefix
fort
ands
respectively. What am I missing?Steps To Reproduce
<leader>
Expected Behavior
Shows the same label names as in normal mode.
Repro
No response