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: Dynamic description of the mapping #666

Closed fpohtmeh closed 1 month ago

fpohtmeh commented 1 month ago

Did you check the docs?

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

Description is always a fixed string. In some cases, it's useful to see context-related info in the description. For example:

Describe the solution you'd like

The keymap description is dynamically calculated, and the result may be based on context (current buffer id, current window id)

Describe alternatives you've considered

I understand that API requires description as text in the mappings. I wonder if the feature looks feasible and if you see the potential in the dynamic descriptions in the which-key

Mini.clue plugin has a concept of generators. Maybe in which-key it's also possible to support some generators, where the description will be recalculated on every opening

Additional context

Nvim 0.10.0 LazyVim 12.28.0 Which-key https://github.com/folke/which-key.nvim/commit/05bd8701dd5d7e90b2f5c4ae05f9471641400bed

folke commented 1 month ago

Added