Closed amandeepgautam closed 3 years ago
vim-lsp-cxx-highlight tries to follow the currently selected vim colorscheme as closely as possible, however since vim doesn't have a highlight group for all C++ syntax there are a couple of hardcoded ones. These are the defaults for them:
hi default LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#AD7FA8 cterm=none gui=none
hi default LspCxxHlGroupNamespace ctermfg=Yellow guifg=#BBBB00 cterm=none gui=none
hi default LspCxxHlGroupMemberVariable ctermfg=White guifg=White
You can remap them like so to your color of choice by adding these to your vimrc:
" Set EnumConstant to red
hi LspCxxHlGroupEnumConstant ctermfg=Red guifg=Red cterm=none gui=none
" Set Namespaces to bold blue
hi LspCxxHlGroupNamespace ctermfg=Blue guifg=Blue cterm=bold gui=bold
" Set member variables to green
hi LspCxxHlGroupMemberVariable ctermfg=Green guifg=Green cterm=none gui=none
or you can link them to an existing highlight group thats part of your color scheme:
hi link LspCxxHlGroupEnumConstant MyColorSchemeCppEnumConstant
hi link LspCxxHlGroupNamespace MyColorSchemeCppNamespace
hi link LspCxxHlGroupMemberVariable MyColorSchemeCppMemberVar
I'm wondering if we could do this:
if l:bg == 'dark'
hi LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#AD7FA8 cterm=none gui=none
hi LspCxxHlGroupNamespace ctermfg=Yellow guifg=#BBBB00 cterm=none gui=none
hi LspCxxHlGroupMemberVariable ctermfg=White guifg=White
else
hi LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#573F54 cterm=none gui=none
hi LspCxxHlGroupNamespace ctermfg=Yellow guifg=#3D3D00 cterm=none gui=none
hi LspCxxHlGroupMemberVariable ctermfg=Black guifg=Black
endif
Hi! Where can I get the full list of highlight groups that can be modified?
@Alexey104 I guess the file syntax/lsp_cxx_highlight.vim has all of them.
@Kamilcuk, Thank you!
@yatli's suggestions is great, with it the plugin becomes usable with light background schemes like solarized.
Thanks @yatli, your suggestion looks good. I added it as a setting which can be enabled like so:
let g:lsp_cxx_hl_light_bg = 1
I wanted to detect and enable the setting automatically but I couldn't figure out a good way as the background color could be any arbitrary hex color when running in a full color terminal or gvim. If anyone has a suggestion for a way to do this I would appreciate it.
@amandeepgautam I'm closing the issue as the the low constrast should be fixable either by the new setting or by one of the above comments. If there's further issues please reopen.
Can we change the available colour scheme? The problem is with my current terminal background, some colours have very low contrast.