Skip to content

Conversation

@Daniel-De-Dev
Copy link

@Daniel-De-Dev Daniel-De-Dev commented Nov 25, 2025

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)

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.
@Daniel-De-Dev Daniel-De-Dev changed the title feat(keymaps): implemented more detailed descriptions (#2281) feat(keymaps): implemented more detailed descriptions (fixes #2281) Nov 25, 2025
This is to pass the stylua check
@Daniel-De-Dev Daniel-De-Dev changed the title feat(keymaps): implemented more detailed descriptions (fixes #2281) feat(keymaps): implemented more detailed descriptions Nov 25, 2025
@saghen
Copy link
Owner

saghen commented Nov 25, 2025

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

@Daniel-De-Dev
Copy link
Author

Daniel-De-Dev commented Nov 26, 2025

@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

- Instead if using a predefined table, the readable names are instead
generated by simply substituting '_' with space, then captilize the
first letter of each token.

- Changed prefix to instead be `blink.cmp: `

- Removed mode subfix
@saghen
Copy link
Owner

saghen commented Nov 26, 2025

"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.

- Update comment for clarity
- Abbreviate '<Custom Function>' to '<Custom Fn>' to save UI space
@Daniel-De-Dev Daniel-De-Dev marked this pull request as ready for review November 26, 2025 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants