blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

feat(keymaps): implemented more detailed descriptions

Open Daniel-De-Dev opened this issue 1 month ago • 3 comments

By default all keymaps got the description blink.cmp for someone new to the keymaps (like me) it's very helpful to with a tool like Telescope be able to quickly look up what keymaps do. Hence the description is very important to provide the detail.

Logic has been added to generate a description in the format:

Blink: command_1, command_2, ... (mode)

This is just a very quick solution implemented which is good enough for me, as far as im aware this change is self contained and affects essentially nothing other than the descriptions.

(draft for #2281)

Daniel-De-Dev avatar Nov 25 '25 18:11 Daniel-De-Dev

Neat thanks! I'd prefer to map the command to human readable with just a basic .split('_').map(capitalize).join(' ') and use blink.cmp: as the prefix. So for example, blink.cmp: Show Documentation

saghen avatar Nov 25 '25 21:11 saghen

@saghen Thanks for the response!

map the command to human readable with just a basic .split('_').map(capitalize).join(' ')

That is an elegant solution, I'll switch to that.

use blink.cmp: as the prefix

Makes sense. I will update the PR with these changes shortly.

I do have some questions.

Currently fallback and fallback_to_mappings are filtered out from the description, as to me, they felt like noise. are you okay with keeping them excluded?

For anonymous functions, I went with a default string of "Custom" to be added, is this prefered? I was thinking I could implement support for a tuple format like { function() ... end, "My Description" } to allow for user defined descriptions

I could add support while keeping backward compatibility, if you think that adds value.

  if command == 'fallback' or command == 'fallback_to_mappings' then
    -- ...
  elseif type(command) == 'function' then
    -- ...
  elseif type(command) == 'table' and type(command[1]) == 'function' then
    -- ...
  elseif require('blink.cmp')[command]() then
    -- ...
  end

Daniel-De-Dev avatar Nov 26 '25 02:11 Daniel-De-Dev

"Custom" for functions and excluding the fallbacks works with me. I don't think we should support descriptions on functions, since we'd remove it shortly with v2's cmp.keymap.set where we can support descriptions explicitly.

saghen avatar Nov 26 '25 04:11 saghen