nvim-treesitter-textobjects icon indicating copy to clipboard operation
nvim-treesitter-textobjects copied to clipboard

Register key mappings to which-key

Open theHamsta opened this issue 1 year ago • 5 comments

Fixes #232

@danielo515 are you using https://github.com/folke/which-key.nvim ? This should set description for this plugin. How can I register for telescope's which_key? Do want to additionally want to overwrite the automatically generated descriptions?

I don't think there is a generic way to set a description for a key mapping. ~~@folke maybe it would be an idea to add a "description" key to opts of nvim_buf_add_keymap that can be retrieved by new API function? It is difficult for third party plugins to annotate their keybindings that is not taylored to one specific which-key plugin ~~ (nvim_buf_add_keymap already has desc)

grafik

theHamsta avatar Jul 30 '22 10:07 theHamsta

The description is inaccurate in a way that we only set the bindings dynamically when tree-sitter is enabled for the buffer. The which-key hints will however appear for all buffers. Not just the ones for which the keybindings were enabled

theHamsta avatar Jul 30 '22 10:07 theHamsta

Ohh! nvim_buf_set_keymap already has a desc key!

theHamsta avatar Jul 30 '22 10:07 theHamsta

grafik

theHamsta avatar Jul 30 '22 11:07 theHamsta

Ohh! nvim_buf_set_keymap already has a desc key!

Yes, that is the option I was referring to

danielo515 avatar Jul 30 '22 12:07 danielo515

Can you test now?

grafik

Config like this grafik

theHamsta avatar Jul 31 '22 14:07 theHamsta

@kyazdani42 good to go?

theHamsta avatar Aug 12 '22 20:08 theHamsta