Search code examples
vimcolorsvim-plugin

How to change Coc Vim Pmenu Syntax


I have an issue where the pmenu generated by the coc.vim have colors that do not align well with my desired background color for the pmenu.

This is my generic pmenu. Note that the color scheme is just a black foreground and a green background:

regular pmenu

This is specifically the hint box that comes up when I write a function or method that Coc Vim recognizes and I press tab to autocomplete. This is how I want it to look, mostly all black color scheme with the pmenu background I configured:

this is how I want it to look

Here is the ugly one. This one shows up when I do the SHIFT + K to bring up the help/documentation on a function/method after the fact:

this one highlights syntax with ugly colors

Is this a configuration issue with vim or with coc? Here is the configuration file I source with my .vimrc file :

hi Pmenu ctermfg=black ctermbg=DarkGreen 
hi PmenuSel ctermfg=white ctermbg=DarkGreen 

hi CocErrorSign ctermfg=red  guibg=red
hi CocErrorFloat ctermfg=white ctermbg=red

hi CocInfoSign ctermfg=blue 
hi CocInfoFloat ctermfg=white ctermbg=blue

hi CocWarningSign ctermfg=white ctermbg=yellow

" I have tried all of the below, but to no avail
" hi CocHighlightText ctermfg=black ctermbg=DarkGreen
" hi CocHintSign ctermfg=black ctermbg=DarkGreen
" hi CocHintHighlight ctermfg=black ctermbg=DarkGreen
" hi CocHintVirtualText ctermfg=black

Trying really hard to understand the help page with coc. I think this is the issue:

help page of coc vim

I think that coc is using some of the syntax highlighting that comes with my vim and imposing it on the help box, though I am unsure. I want to remove this behavior. I tried CocHighlightText, since the help page mentioned symbols (not sure what that is) but it didn't seem to work. How can I configure the hint box color scheme when I press SHIFT + K?


Solution

  • I found a couple related highlighting groups:

    highlight CocFloating ctermfg={fg color} ctermbg={bg color} gui={gui color}
    highlight CocErrorFloat ctermfg={fg color} ctermbg={bg color} gui={gui color}
    highlight CocMenueSel ctermfg={fg color} ctermbg={bg color} gui={gui color}
    

    I think that CocFloating might be the one you are looking for, this is the one that changes coc's pmenu text and background. CocMenuSel changes the selected entry colors of coc's pmenu, and CocErrorFloat changes the colors of error messages from when you hover over errors.

    There are also some more popup menu highlight groups if you do :h CocPum