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
4.76k stars 154 forks source link

feature: Open different which-key registered keymaps accordingly to filetype/buftype #611

Closed noghartt closed 1 week ago

noghartt commented 3 weeks ago

Did you check the docs?

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

Not really, just a DX improvement through which-key usage.

Describe the solution you'd like

I would like to have different registered keymaps accordingly to which kind of filetype/buftype has being focused at the moment.

In case, the premise is to be similar to Emacs, where based on a specific major/minor mode, we can have a specific set of registered keymaps. The idea was to replicate this behavior using a pattern maching based on the buftype/filetype of the current focused buffer.

Describe alternatives you've considered

I don't have exactly any concern or alternative related, but having the ability to be able to dinamically set a range of keymaps accordingly to a constraint would be useful in some cases.

Additional context

No response

qaptoR commented 2 weeks ago

Having come from Doom-Emacs myself, this is definitely a feature that I like, so that for instance a specific key-space can be reused again and again for different contexts.

I'm not sure if this is the same thing as well, but I'm also looking at how I can have which-key show the keybinds for a particular modal like the telescope.project picker, and have it also be relative to whether it's in insert or normal mode.

folke commented 1 week ago

which-key already works with buffer-local keymaps

noghartt commented 1 week ago

which-key already works with buffer-local keymaps

@folke, do you have any example of how we can approach which-key to handle buffer-local keymaps? I didn't find any example about that.