Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description to keymaps that are set #6

Closed
akinsho opened this issue Jun 7, 2022 · 6 comments · Fixed by #8
Closed

Add description to keymaps that are set #6

akinsho opened this issue Jun 7, 2022 · 6 comments · Fixed by #8
Assignees

Comments

@akinsho
Copy link

akinsho commented Jun 7, 2022

Hi @johmsalas,

Great work on this plugin, really enjoying using it so far 👍🏿

One very small thing I noticed was that the plugin sets a bunch of keymaps but doesn't set a desc on them, this is becoming increasingly useful as plugins like telescope and whichkey use this value to show readable descriptions for mappings. For any user of those or other plugins using this key, it would be really useful to get a description when setting the keymap so that it's clearer what can be done

Whichkey

image

Telescope

image

@johmsalas
Copy link
Owner

Good suggestion. I had not considered adding an integration with Which key but already have a working PoC. Should be solved soon

@akinsho
Copy link
Author

akinsho commented Jun 8, 2022

@johmsalas just to be clear, you don't need to integrate with the plugin directly both telescope and which key will read the value of the desc key when set in a keymap so all you would need to do is just add a desc key when calling set keymap

@akinsho
Copy link
Author

akinsho commented Jun 8, 2022

e.g.

vim.keymap.set('n', '<key>', lua_func, {desc = 'this is what I do'})

Both plugins will automatically show this is what I do for that key when searched

@johmsalas
Copy link
Owner

Wow so easy. Thanks @akinsho

Created a DRAFT PR. #8
I'm also adding integration with whichkey to show descriptions for partial keybindings, like ga or gao

@johmsalas johmsalas linked a pull request Jun 8, 2022 that will close this issue
@johmsalas johmsalas self-assigned this Jun 8, 2022
@johmsalas
Copy link
Owner

Had to revert the PR. Will publish it soon, will need a test environment without which key. will setup a docker for this

@johmsalas johmsalas reopened this Jun 9, 2022
@akinsho
Copy link
Author

akinsho commented Jun 9, 2022

I left a comment in the old pull request about why you were seeing the issue. It was an issue with how pcall was being used with whichkey

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 a pull request may close this issue.

2 participants