Add <C-u>/<C-d> cmp mapping to scroll cmp docs
I have added control-u and control-d to scroll the auto completion window up and down respectively.
For the average new kickstart user, this will give them the ability to scroll documentation without a mouse and keyboard.
I am fond of reading documentation from the autocomplete window and being able to scroll the window without a mouse is a must have for my setup, I believe it may be the same for many others.
Hi.
- Your PR has no description. Please give us some background on why you want this and what it will do for the average new Neovim kickstart user.
- Please ensure that your change is formatted with Stylua or that check will fail.
Hi.
- Your PR has no description. Please give us some background on why you want this and what it will do for the average new Neovim kickstart user.
- Please ensure that your change is formatted with Stylua or that check will fail.
Thanks for the feedback- I was editing the file directly on github, do I need to pull my fork and format in neovim? I just kinda did an eyeball on the tab spacing but things got a bit weird somewhere.
Hi.
I don't mean to be dismissive about this but - So you submitted this PR without ever testing it locally?
Please:
- Test your proposed code changes thoroughly.
- Ensure that they are formatted with the Stylua formatter. You can see the failing check with details.
Thanks.
Perhaps worth mentioning, the cmp recommended keymaps for this are: https://github.com/hrsh7th/nvim-cmp?tab=readme-ov-file#recommended-configuration
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
This is also what was in kickstart before the 2024 rewrite:
git blame init.lua | grep scroll_docs
e39a8bce (Ari Pollak 2023-12-21 ['<C-b>'] = cmp.mapping.scroll_docs(-4),
^4c4096c (TJ DeVries 2022-06-23 ['<C-f>'] = cmp.mapping.scroll_docs(4),
Perhaps worth mentioning, the cmp recommended keymaps for this are: https://github.com/hrsh7th/nvim-cmp?tab=readme-ov-file#recommended-configuration
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-f>'] = cmp.mapping.scroll_docs(4),This is also what was in kickstart before the 2024 rewrite:
git blame init.lua | grep scroll_docs e39a8bce (Ari Pollak 2023-12-21 ['<C-b>'] = cmp.mapping.scroll_docs(-4), ^4c4096c (TJ DeVries 2022-06-23 ['<C-f>'] = cmp.mapping.scroll_docs(4),
That seems fine to me, I personally prefer up (u) and down (d) but regardless, I think it's generally useful for newcomers who don't know about cmp scrolling.
Will change to use C-b and C-f if that is the consensus.
Right the keys have similar meanings in standard vim:
CTRL-U Scroll window Upwards in the buffer
CTRL-D Scroll window Downwards in the buffer
CTRL-B Scroll window [count] pages Backwards (upwards)
CTRL-F Scroll window [count] pages Forwards (downwards)
So both options seem fine, but since cmp recommendation is with c-b/c-f I think it's best to follow them.
Since these are cmp recommended, I think it's a good addition to add back in. Thanks!