hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
8.14k stars 405 forks source link

feat: allow individual hl custamization of scrollbar for docs and menu #2078

Open jonathan-elize opened 3 weeks ago

jonathan-elize commented 3 weeks ago

This allows you to set the highlight group of the scrollbar in the completion menu and doc menu to be something you'd want to be specifically. This solves this issue here: https://github.com/hrsh7th/nvim-cmp/issues/1775

This is just an example of the change here (I chose wild colors just to make them stand out):

Screenshot 2024-11-02 at 2 05 07 PM

The way you would do this by using scrollbar_winhighlight and scrollbar_thumb_winhighlight and setting them to highlights you'd want to use:

  cmp.setup({
    window = {
      documentation = {
        scrollbar_winhighlight = "EndOfBuffer:DocCmpSbar,NormalFloat:DocCmpSbar",
        scrollbar_thumb_winhighlight = "EndOfBuffer:DocCmpThumb,NormalFloat:DocCmpThumb",
      },
      completion = {
        scrollbar_winhighlight = "EndOfBuffer:DocCmpSbar,NormalFloat:DocCmpSbar",
        scrollbar_thumb_winhighlight = "EndOfBuffer:DocCmpThumb,NormalFloat:DocCmpThumb",
      },
    },
  })

  vim.cmd('highlight CmpSbar guibg=red')
  vim.cmd('highlight CmpThumb guibg=green')

  vim.cmd('highlight DocCmpSbar guibg=blue')
  vim.cmd('highlight DocCmpThumb guibg=orange')