nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
18.9k stars 21.67k forks source link

WhichKey conflicting keymaps warning #893

Closed bawolk closed 5 months ago

bawolk commented 5 months ago

Describe the bug

I have not added any key modifications to the init.lua file.

which-key: require("which-key.health").check()

WhichKey: checking conflicting keymaps ~

Run:checkhealth

Desktop

Neovim Version

v0.9.5

feoh commented 5 months ago

Firstly, this really doesn't matter. I don't blame you for filing because nobody likes to see healthcheck warnings but there's no functional issue here.

That said, I'm confused as to why this behavior is occurring. Most of these are regular old keybinds we set in init.lua and when it cites the conflicting rhs it's empty so ... What's up with that? :)

@tjdevries @dam9000 thoughts?

dam9000 commented 5 months ago

These are caused by the mini/surround plugin. Checking for example :nmap sf gives:

n  sfn         * <Lua 145: ~/.local/share/nvim/lazy/mini.nvim/lua/mini/surround.lua:1208>
                 Find next right surrounding
n  sfl         * <Lua 140: ~/.local/share/nvim/lazy/mini.nvim/lua/mini/surround.lua:1208>
                 Find previous right surrounding
n  sf          * <Lua 134: ~/.local/share/nvim/lazy/mini.nvim/lua/mini/surround.lua:1208>
                 Find right surrounding

So they do conflict, but they also work as long as you type them within the which-key timeout period. Normally these are followed by a surrounding character, for example ", like this: sf" or sfl" and it works, but you need to type them quickly. However if you pause for 1 or 2 seconds in the combo sfl" between sf and l" it won't work the same as sfl" and will search for letter l instead of the ". I guess that's the reason why which-key warns about it, because the combos can behave differently depending on how quickly you type them. I would say having such conflicting combos in mini/surround is probably not the best selection, but what can we do about it? Perhaps the other surround plugins behave better, or it might be the same, I don't know, didn't check. I personally never use the surround functionality so this has not bothered me.

bawolk commented 5 months ago

Thanks for explaining the source of the warning. You taught me something new, which is always appreciated. I figured it was nothing to worry about, but since kickstart is aimed at new Neovim users, perhaps an added line or two in the init.lua file in the mini.surround section might alert a new user to the possible warnings. Of course, that's how things tend to bloat. :-)

feoh commented 5 months ago

Nothing to do here unless we pick a different, potentially non conflicting surround plugin.

Thanks for your submission!