Closed D00mch closed 2 years ago
I have the same issue on neovim nightly + following master. Do not have the issue on neovim 0.7. There has been a lot of keymap changes over the last 2 days so I'm guessing that's what's causing the issue.
I had a similar issue (same error thrown) happen following neovim master where pressing <c-w>
+ another key (default vim keybinds) would not work anymore and throw that error. Did not modify my config at all beside updating plugins and neovim.
In my case, I had to now put the window preset to false otherwise it wouldn't let me use <c-w>
anymore:
so changed
presets = {
...
windows = true, -- default bindings on <c-w>
...
},
to
presets = {
...
windows = false, -- default bindings on <c-w>
...
},
which-key.nvim is passing internal keycodes (the string returned by nvim_replace_termcodes()
) to nvim_set_keymap()
, which is not guaranteed to work.
@zeertzjq any idea why this seem to have started happening recently? Could it perhaps be linked to some of the changes on how neovim now handles simplifiable keys?
Yes. Now unmapping <C-W>
will not remove a mapping whose lhs is vim.api.nvim_replace_termcodes('<C-W>', true, true, true)
. Therefore which-key.nvim fails to remove the hooks it created. Before this change which-key.nvim didn't have a problem with keys with a Ctrl modifier, but already had a problem with keys with an Alt modifier or special keys. For example, pressing <F2>
doesn't trigger which-key with the following mappings:
['<F2>'] = {
a = {'<Nop>', ''},
b = {'<Nop>', ''},
},
In this case, which-key.nvim just creates the wrong hooks, so it doesn't work at all instead of hanging. Now this problem has extended to keys with a Ctrl modifier, and in this case creating the hooks succeeds, but removing the hooks fails.
thanks for the great explanation, saw bfredl PR and then yours, thought it might have something to do with it
I checked it and it doesn't fix the alt-problem. I changed description a little bit. The problem is that pressing alt+"any key" in insert mode steals the focus and result with the error and insertions of lot's of symbols like in the video in the description.
https://user-images.githubusercontent.com/14236531/166142345-90d30589-1dc8-46df-b032-e9d95c0d1a97.mov
I used to be able to type alt+\<key> in the insert mode and writy symboles liek: ®, å, ß (for alt+\<r, a, s> respectively).
My use case was to type this keys in insert mode, copy the symbol and map it like:
Now, whenever I type alt+\<key> in the insert mode ("alt+s", for example), I see my cursor at the command line, all keys are ignoreed, and the only way to exit from it is to type, after that I see lots of noncense symbols inserted: åååååååååååååååååa....