kickstart.nvim icon indicating copy to clipboard operation
kickstart.nvim copied to clipboard

Add <C-u>/<C-d> cmp mapping to scroll cmp docs

Open RafaelZasas opened this issue 1 year ago • 6 comments

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.

RafaelZasas avatar Mar 12 '24 13:03 RafaelZasas

Hi.

  1. 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.
  2. Please ensure that your change is formatted with Stylua or that check will fail.

feoh avatar Mar 12 '24 14:03 feoh

Hi.

  1. 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.
  2. 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.

RafaelZasas avatar Mar 12 '24 14:03 RafaelZasas

Hi.

I don't mean to be dismissive about this but - So you submitted this PR without ever testing it locally?

Please:

  1. Test your proposed code changes thoroughly.
  2. Ensure that they are formatted with the Stylua formatter. You can see the failing check with details.

Thanks.

feoh avatar Mar 12 '24 15:03 feoh

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),

dam9000 avatar Mar 12 '24 15:03 dam9000

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.

RafaelZasas avatar Mar 12 '24 16:03 RafaelZasas

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.

dam9000 avatar Mar 12 '24 16:03 dam9000

Since these are cmp recommended, I think it's a good addition to add back in. Thanks!

tjdevries avatar Mar 15 '24 14:03 tjdevries