I'm trying to do this on my .vimrc
:
hi link SyntasticErrorLine SignColumn
hi link SyntasticErrorSign SignColumn
hi SyntasticErrorSign guifg=red ctermfg=red
What I want is to have the SyntasticErrorSign
highlighting group with the same background as SignColumn
but with custom foreground colors.
Vim docs says:
- As soon as you use a ":highlight" command for a linked group, the link is removed.
So, the way I'm doing it won't work anyway, is there a way to achieve that?
@Kent answer was good, but it seems there's a problem with synIDattr
when one doesn't pass the mode
argument, it fails to return the attribute in GUI mode (gvim). I've learned this from vim-arline plugin sources.
I've solved my problem with:
hi link SyntasticErrorLine SignColumn
exec 'hi SyntasticErrorSign guifg=red ctermfg=red' .
\' guibg=' . synIDattr(synIDtrans(hlID('SignColumn')), 'bg', 'gui') .
\' ctermbg=' . synIDattr(synIDtrans(hlID('SignColumn')), 'bg', 'cterm')
If you want to "steal" some hl-attribute value from other group, you don't have to link
, you just get the value for your own usage.
For your problem, try to add this line into your .vimrc file.
exec 'hi SyntasticErrorSign guifg=red ctermfg=red ' . (has("gui_running")? 'guibg=':'ctermbg=') . synIDattr(hlID('SignColumn'),'bg')
The line sets fg(gui and cterm)
of SyntasticErrorSign
group as red
, and uses the same bg color of group SignColumn
, depends on you are in gvim
or vim
. I think it should be what you are looking for.
For those functions, you could just :h xxx()
to get detailed information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With