Closed pk-kampanart closed 5 months ago
This is actually really cool. Was just looking to implement something similar :)
fyi: It also works with an empty mapping like
map("n", "<leader>h", "", {desc = "Help Prefix"})
Thanks!
Trying to set up a prefix like this (with updated which-key (c1958e2) and lazy.nvim (0c1ec52)). Using the keys table in lazy.nvim config:
{"<leader>t", "<nop>", mode = "n", desc = "+terminal" },
{"<leader>tf", "<cmd>ToggleTerm direction=float<cr>", mode = "n", desc = "Toggleterm float"},
Which-key doesn't toggle for this key mapping (if it's typed fast enough), which is a drawback. I would wish for a UX where <leader>t
will open which-key and wait for the real kemap (<leader>tf
for toggleterm float etc.)
@bluss can you update both which-key and lazy?
updated both. Fwiw, the behaviour is still the same (before and after lazy load too); typing <leader>t
quick enough is just a nop and doesn't open which-key. Don't know if that's expected. Neovim v0.10.0
which-key indeed has to have run at least once, otherwise your nop keymap would be executed.
You can still use register
like before. That still works.
Got it, thank you!
There was indeed something wrong there and should now be fixed!
https://github.com/folke/which-key.nvim/commit/ccf027625df6c4e22febfdd786c5e1f7521c2ccb
Thank you @folke. It works like I would prefer now (which-key 0099511, lazy eb49574). This case still is a minor fail: In that configuration above, if <leader>tf
is pressed fast enough (no which-key trigger) then any <leader>t
after that does not trigger which-key to open.
User can now use keymaps with to set
desc
as label to prefix keyFix some typo
Example: