which-key.nvim
which-key.nvim copied to clipboard
bug: `<Space>`, `<Tab>`, `<CR>` etc. keys are case-sensitive in `key_labels` setting
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)
v0.10.0-dev-1046+g3afbf4745b
Operating system/version
ArchLinux
Describe the bug
In key_labels
setting, <Space>
, <Tab>
, <CR>
etc. key names are case-sensitive
Steps To Reproduce
- Set
key_labels
setting in which-key options, for example:
key_labels = {
["<Space>"] = "SPC",
}
- Set keymap that uses said key
- Press prefix keys to view description of said keymap
- Watch as it still says
<space>
. Same thing would happen for other keys.
Expected Behavior
<Space>
gets replaced with SPC
. Same thing for other keys.
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 = {
key_labels = {
["<Space>"] = "SPC",
},
},
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
vim.keymap.set("n", "<Space><Space>", [[<Cmd> echo "Space!"<CR>]], { desc = "SPAAACE!!!" })