-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Did you check docs and existing issues?
- I have read all the which-key.nvim docs
- I have updated the plugin to the latest version before submitting this issue
- I have searched the existing issues of which-key.nvim
- I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.11 (but had problem on 0.10 as well)
Operating system/version
MacOS 15.3
Describe the bug
gcc to comment a line of code doesn't work sometimes. When I uninstall which-key the problem goes away.
Steps To Reproduce
- Edit a file:
nvim init.lua - Close the buffer using
Snacks.buffer_delete; problem does not happen on initial buffer. - Open
init.luaagain, using Snacker file picker - Type
gccto comment a line. It doesn't work. - Type
gwait for which-key to popup then typecc. It works - the line is commented. - All future
gcccommands work without waiting after typingg - Repeat by going to step 2 (
gccis broken again)
I included the debug log below and commented it with the steps above.
I also noted the warning in checkhealth which is specifically around gc and gcc. Given that is a standard nvim keymap I figure which-key should work without changing a standard keymap.
Expected Behavior
gcc always works
Health
which-key: require("which-key.health").check()
- OK Most of these checks are for informational purposes only.
WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
Please |DON'T| report these warnings as an issue.
Checking your config ~
- OK |mini.icons| is installed
- OK |nvim-web-devicons| is installed
Checking for issues with your mappings ~
- OK No issues reported
checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcO>, <gcc>, <gco>:
- <gc>: Toggle comment
- <gcO>: Add Comment Above
- <gcc>: Toggle comment line
- <gco>: Add Comment Below
- OK Overlapping keymaps are only reported for informational purposes.
This doesn't necessarily mean there is a problem with your config.
Checking for duplicate mappings ~
- OK No duplicate mappings found
Log
Debug Started for v3.17.0
{
commit = "fcbf4eea17cb299c02557d576f0d568878e354a4"
}
LspAttach(1)
new Mode(n:1)
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
new Mode(n:1)
LspAttach(1)
Trigger(del) Mode(n:1) < g , > <C-W> z [ " ' ` g` g' z= ]
new Mode(n:1)
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
on_key: ,
State(start): Mode(n:0) Node(,) { keys = "," }
update Mode(n:1)
continue: , Mode(n:1)
getchar
on_key: c
got: c
suspend: Mode(n:1)
Trigger(del) Mode(n:1) < g , > <C-W> z [ " ' ` g` g' z= ]
feedkeys: Mode(n:1) ,c
-- close initial buffer - problem doesn't seem to happen on initial buffer
on_key: ,c
BufNew(2)
LspDetach(1)
LspDetach(1)
BufEnter(2)
new Mode(n:2)
BufNew(3)
Trigger(add) Mode(n:2) ' " ` g` g' z= < g , > <C-W> z [ ]
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
on_key: ,
State(start): Mode(n:0) Node(,) { keys = "," }
update Mode(n:2)
continue: , Mode(n:2)
getchar
on_key: e
got: e
suspend: Mode(n:2)
Trigger(del) Mode(n:2) ' " ` g' z= < g , > <C-W> z [ ] g`
feedkeys: Mode(n:2) ,e
-- open snacks file picker
on_key: ,e
Trigger(add) Mode(n:2) ' " ` g` g' z= < g , > <C-W> z [ ]
BufNew(4)
BufNew(5)
BufNew(6)
BufNew(7)
BufNew(8)
BufNew(9)
BufEnter(7)
new Mode(n:7)
Trigger(add) Mode(n:7) " ' ` g` g' z= < g ] , > z <C-W> [
ModeChanged(n:i)
new Mode(i:7)
Safe(true)
Trigger(add) Mode(i:7) <C-R>
-- pick first file in the picker
on_key: <CR>
ModeChanged(i:n)
Safe(true)
BufEnter(2)
LspAttach(1)
Trigger(del) Mode(n:2) ' " ` g` g' z= < g , > <C-W> z [ ]
Trigger(del) Mode(i:7) <C-R>
Trigger(del) Mode(n:7) < g ] , > z <C-W> [ " ' ` g` g' z=
LspAttach(1)
BufReadPost(1)
BufEnter(1)
new Mode(n:1)
Trigger(del) Mode(n:1) " ` g` g' z= < g , > <C-W> z [ ] '
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
new Mode(n:1)
-- type `gcc` to comment a line; this does not work
on_key: gc
ModeChanged(n:no)
new Mode(o:1)
Safe(true)
State(start): Mode(o:0) Node() { defer = false }
update Mode(o:1)
continue: Mode(o:1)
getchar
Trigger(add) Mode(o:1) ] [ g
on_key: c
got: c
suspend: Mode(o:1)
Trigger(del) Mode(o:1) ] [ g
feedkeys: Mode(o:1) c
-- presumably the second `c` from typing `gcc above`
on_key: c
ModeChanged(no:n)
Safe(true)
Trigger(add) Mode(o:1) ] [ g
-- try again to comment; this time type `g` wait for which-key popup
-- then typed `cc` - this command worked (commented the line)
on_key: g
State(start): Mode(n:0) Node(g) { keys = "g" }
update Mode(n:1)
continue: g Mode(n:1)
getchar
on_key: c
got: c
continue: gc Mode(n:1)
getchar
on_key: c
got: c
suspend: Mode(n:1)
Trigger(del) Mode(n:1) " ` g` g' z= < g , > <C-W> z [ ] '
feedkeys: Mode(n:1) gcc
on_key: gcc
ModeChanged(n:no)
Unsafe(pending "_")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) ] [ g
ModeChanged(no:n)
cooldown
Trigger(add) Mode(o:1) ] [ g
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
-- typed `gcc` again to uncomment line; no pause when typing - command worked!
-- in fact all future `gcc` commands work UNTIL I close the buffer (snacks bufdelete)
-- and then I open a file again. Then I'm back to `gcc` doesn't work until I
-- type `g` wait then type `cc`
on_key: g
State(start): Mode(n:0) Node(g) { keys = "g" }
update Mode(n:1)
continue: g Mode(n:1)
getchar
on_key: c
got: c
suspend: Mode(n:1)
Trigger(del) Mode(n:1) " ` g` g' z= < g , > <C-W> z [ ] '
feedkeys: Mode(n:1) gc
on_key: gcc
ModeChanged(n:no)
Unsafe(pending "_")
suspend: Mode(o:1)
Trigger(del) Mode(o:1) ] [ g
ModeChanged(no:n)
cooldown
Trigger(add) Mode(o:1) ] [ g
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
-- :q to quit nvim
on_key: :
ModeChanged(n:c)
new Mode(c:1)
Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: q
BufNew(15)
on_key: <CR>
ModeChanged(c:n)
Unsafe(command-mode)
suspend: Mode(n:1)
Trigger(del) Mode(n:1) " ` g` g' z= < g , > <C-W> z [ ] '
ModeChanged(n:c)
cooldown
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
on_key: n
ModeChanged(c:r?)
Unsafe(command-mode)
suspend: Mode(n:1)
Trigger(del) Mode(n:1) " ` g` g' z= < g , > <C-W> z [ ] '
Trigger(add) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
LspDetach(1)
Trigger(del) Mode(n:1) ' " ` g` g' z= < g , > <C-W> z [ ]
Trigger(del) Mode(c:1) <C-R>
Trigger(del) Mode(o:1) ] [ g
Repro
I could not reproduce with the repro.lua.filmaj, Frestein and pedro757
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working