folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

feature: expand groups without defined names #670

Closed ljupchokotev closed 1 month ago

ljupchokotev commented 1 month ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

Mappings that do not have a group defined show up as +X keymaps which is not very useful. These mappings sometimes come from plugins which are not expected to setup any groups for which-key. And sometimes you might want to keep some keymaps top level in which-key instead of hiding them in a group.

Describe the solution you'd like

Add an option to expand all keymaps that belong to a group without a name i.e. +X keymaps. This will allow users to decide which keys to keep in a group and which keys to expand by creating a group or not.

Describe alternatives you've considered

I can create my own groups for all mappings.

Additional context

No response

folke commented 1 month ago

Check the config for opts.expand.

You can now do something like:

 opts.expand = function(node)
   return not node.desc -- expand all nodes without a description
end