I understand that I can change my coc.nvim colours from inside neovim, but how do I do so permanently from the init.vim file (or otherwise), so that they're changed automatically every time I open the editor?
Asked
Active
Viewed 692 times
0
-
https://vi.stackexchange.com/ – Rob Mar 10 '22 at 23:35
1 Answers
1
My solution comes from the stackoverflow post you shared, this vi stackexchange post and learning a bit of vimscript with learning vimscript the hard way.
On your init.vim
file you can write the following:
func! s:my_colors_setup() abort
highlight CocFloating ctermbg=color " For background color
highlight CocErrorFloat ctermfg=color " For text color
endfunc
augroup colorscheme_coc_setup | au!
au VimEnter * call s:my_colors_setup()
augroup END
This works by calling the highlight command on a function that gets called when vim starts.
CocErrorFloat
changes the text color for error popups, you could also change warnings, infos and hints with CocWarningFloat
, CocInfoFloat
and CocHintFloat
respectively.

Francisco Aguirre
- 426
- 3
- 4
-
Seems to work quite well, BUT, I have to `:colorscheme xxxx` at least once to get it working. So I'm still have to interact - it's not automatically done. – Thomas Browne Mar 14 '22 at 11:39
-
1You're right! I didn't know why `ColorScheme` worked. I have `colorscheme vim-monokai-tasty` in my config file. You could add a colorscheme if you'd like, but I found out the event `VimEnter` works automatically, I'll update my answer. – Francisco Aguirre Mar 14 '22 at 14:50