jackguo380 / vim-lsp-cxx-highlight

Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
MIT License
339 stars 26 forks source link

Distinguish between local vs static vs global variables #13

Closed Kyran-C closed 5 years ago

Kyran-C commented 5 years ago

Currently local, static and global variables all resolve to the hl group LspCxxHlSymVariable but the language server is able to distinguish between them.

Locals: parentKind = Function Static: parentKind = Unknown, storage = Static Global: parentKind = Unknown, storage = None

jackguo380 commented 5 years ago

Hi Kryan-C,

I agree that that would be useful but it would also increase number of custom highlight groups added by this plugin. With more of these highlight groups each with unique colors there is a higher chance that it will conflict with someone's color scheme.

So instead of changing the plugin's default behavior you can add these customizations to your vimrc:

# Highlight local variables Green
hi LspCxxHlSymFunctionVariable ctermfg=Green guifg=#00FF00 cterm=none gui=none

# Highlight statics Red
hi LspCxxHlSymUnknownStatic ctermfg=Red guifg=#FF0000 cterm=none gui=none

# Highlight globals Red with Bold text
hi LspCxxHlSymUnknownNone ctermfg=Red guifg=#FF0000 cterm=bold gui=bold
Kyran-C commented 5 years ago

Thanks, I didn't know those highlight groups were available. I thought the default groups were the only ones available, but I just found the section in the docs that describes how the highlight groups work. I agree that the defaults should be minimal and allow users to configure things further if they wish.