Closed sahinakkaya closed 10 months ago
What happens if you search using telescope ga.
? Do the keybindings get register in which-key at that moment?
Thanks for reporting it, ~now that I know it is not only happening in my local setup will prioritize it~
No, the mappings are still not registered to whichkey after ga.
I examined the code a little bit. These lines caught my attention: https://github.com/johmsalas/text-case.nvim/blob/d6f121ec471118afb4fc7ed8cafb08eef3e9b307/lua/textcase/plugin/presets.lua#L25-L40
Shouldn't there be more mappings? With the current code, I think it is normal that nothing is visible in whichkey. Only o
is mapped and it is shown in the screenshot above as expected.
I don't know internals of neither whichkey nor this plugin though. You might have wrote it that way on purpose.
There is a loop that iterates all the default_keymapping_definitions
and registers the enabled keybindings
Ok, as far as I can see, it registers them using vim.keymap.set
. I don't know if this is enough for whichkey to pick it up. There are other plugins I am using which is supposed to show up in whichkey but doesn't. ~Maybe there is some whichkey setting that needs to be enabled for picking up vim.keymap.set
mappings.~
Yes, there is. See https://github.com/johmsalas/text-case.nvim/issues/144#issuecomment-1874405579 below.
Which-key is capable of reading nvim registered keymaps. Usually, there is no need to make any extra effort.
Specifically, text-case registers the keymaps directly in which-key, because those are directory-ish records, they don't execute an action but serve as a place to "classify" other keymaps
Is this bug happening only in text-case? would you create an issue in which-key?
I have changed whichkey
setup with default setup:
require("which-key").setup {}
And now after pressing ga
*:
Most of the other issues are fixed too. Like marks or registers not showing up. Looks like my old whichkey config was a bit too old. I need to rewrite it from scratch.
*: Actually, at first it only showed ga.
mapping after pressing ga
. But once I activated telescope, all the other mappings are registered. This was required only once. When I close and reopen neovim, the mappings were available after pressing ga
which was a bit surprising to me. But hey, it works now :partying_face:
You can close this issue or keep it open to make it remind you about the thing I mentioned in * if that is a problem for you.
Last but not least, thank you very much for the help!
Also I am sorry if this issue was a waste of time for you. Looks like I have broken whichkey config for maybe months but I didn't bother fixing it because I didn't feel like I am missing something. But this plugin was so good that I didn't want to forget its keybindings. Thanks again :)
I can agree this plugin highly depends on Which-Key given the amount of bindings xD. We are now working on a milestones to provide "Ergonomics" (not sure that's the name yet, but will be v2), the idea is to make the plugin more accessible
Thanks for sharing your mental process publicly, I keep learning Neovim and this was an enriching issue
And I found the setting in whichkey which is causing this problem:
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
My old config was perfectly fine. I just had to change this line from true
to false
.
@sahinakkaya by the way. Does it work when lazy=true?
@johmsalas yes, it works.
My config:
At first I was lazy loading this plugin but after seeing that I can't see keybindings in whichkey, I disabled lazy loading with
lazy=false
. However, I still can't see the mappings in whichkey.In normal mode after pressing
g
:In normal mode after pressing
ga
:The keybindings are working perfectly fine though.
gac
,gas
etc. It would be nice to also see them in whichkey with their descriptions because I will definitely forget some of the mappings in the future.