[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.5
Operating system/version
Linux (NixOS)
Describe the bug
I recently changed my main <Leader> to <C-Space> and opening neovim now shows an error message.
And when I disable enough things to avoid this error message, the which-key popup is not displayed on <C-Space>..
Steps To Reproduce
Run nvim -u repro.lua 😬
See error:
Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua ...wip/.repro/plugins/which-key.nvim/lua/which-key/util.lua:128: {
internal = { "<", "C", "-", "S", "p", "a", "c", "e", ">", "f", "o", "o" },
keystr = "<Leader>foo",
notation = { "<", "L", "e", "a", "d", "e", "r", ">", "f", "o", "o" }
}
stack traceback:
[C]: in function 'error'
...wip/.repro/plugins/which-key.nvim/lua/which-key/util.lua:128: in function 'parse_keys'
....repro/plugins/which-key.nvim/lua/which-key/mappings.lua:183: in function <....repro/plugins/which-key.nvim/lua/which-key/mappings.lua:171>
vim/shared.lua: in function 'parse'
...wip/.repro/plugins/which-key.nvim/lua/which-key/keys.lua:208: in function 'register'
...wip/.repro/plugins/which-key.nvim/lua/which-key/init.lua:94: in function 'load'
[string ":lua"]:1: in main chunk
Replace (in the repro) the which-key config with config = true to remove the group
(to continue with another similar bug)
Re-open nvim -u repro.lua
See the same error again, this time for the mapping:
Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua ...wip/.repro/plugins/which-key.nvim/lua/which-key/util.lua:128: {
internal = { "<", "C", "-", "S", "p", "a", "c", "e", ">" },
keystr = "<leader>",
notation = { "<", "l", "e", "a", "d", "e", "r", ">" }
}
stack traceback:
[C]: in function 'error'
...wip/.repro/plugins/which-key.nvim/lua/which-key/util.lua:128: in function 'parse_keys'
...wip/.repro/plugins/which-key.nvim/lua/which-key/keys.lua:342: in function 'add_hooks'
...wip/.repro/plugins/which-key.nvim/lua/which-key/keys.lua:350: in function 'add_hooks'
...wip/.repro/plugins/which-key.nvim/lua/which-key/keys.lua:334: in function 'update'
...wip/.repro/plugins/which-key.nvim/lua/which-key/init.lua:96: in function 'load'
[string ":lua"]:1: in main chunk
Replace <C-Space> with <Leader> in the keybind at the bottom of the repo
(to continue with other similar bugs that might be related)
No more error messages on VimEnter
But there seems to be other issues that might be related:
a. I can't use the <C-Space>i keybind at all in this repro (I don't see the msg being echo-ed)
b. Typing <C-Space> and waiting for &timeoutlen does not show the which-key popup 🤔
Expected Behavior
No error on start, and working normally
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".register { ["<Leader>foo"] = "+some-group" }
-- CRASH because of this config
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
vim.g.mapleader = "<C-Space>"
vim.keymap.set("n", "<C-Space>i", "<cmd>echo 'hello from leader'<cr>")
-- CRASH because of this mapping
-- NOTE: does not error if I replace "<C-Space>i" with "<Leader>i"
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.5
Operating system/version
Linux (NixOS)
Describe the bug
I recently changed my main
<Leader>
to<C-Space>
and opening neovim now shows an error message. And when I disable enough things to avoid this error message, the which-key popup is not displayed on<C-Space>
..Steps To Reproduce
Run
nvim -u repro.lua
😬See error:
Replace (in the repro) the which-key config with
config = true
to remove the group (to continue with another similar bug)Re-open
nvim -u repro.lua
See the same error again, this time for the mapping:
Replace
<C-Space>
with<Leader>
in the keybind at the bottom of the repo (to continue with other similar bugs that might be related)No more error messages on
VimEnter
But there seems to be other issues that might be related: a. I can't use the
<C-Space>i
keybind at all in this repro (I don't see the msg being echo-ed) b. Typing<C-Space>
and waiting for&timeoutlen
does not show the which-key popup 🤔Expected Behavior
No error on start, and working normally
Repro