1

I have set my sign column background using hi SignColumn ctermbg=236 in my colorscheme file. However, it seems that the background colors for where there are signs has not been changed, and is the same as my default background color.

Is there a way of changing the background (and if possible, foreground) colors of signs?

The signcolumn/gutter with mismatched background colors

Edit: For further clarification I'm using Syntastic to get these signs in my sign column, in case that's relevant.

1

From the docs (:help syntastic-error-signs):

Signs are colored using the Error and Todo syntax highlight groups by default
(see |group-name|). If you wish to customize the colors for the signs, you
can use the following groups:
    SyntasticErrorSign - For syntax errors, links to "error" by default
    SyntasticWarningSign - For syntax warnings, links to "todo" by default
    SyntasticStyleErrorSign - For style errors, links to "SyntasticErrorSign"
                              by default
    SyntasticStyleWarningSign - For style warnings, links to
                                "SyntasticWarningSign" by default

Example: >
    highlight SyntasticErrorSign guifg=white guibg=red
<
  • Setting Error and Todo in my highlighting worked perfectly! Thanks! – Syne Dec 31 '18 at 17:44
1

It seems you are at least partially aware of how this works but let's lay it out formally...

When you define the sign you specify the highlighting group to be used when that sign is displayed. (Run :hi to see all of your currently defined groups.)

For example, a sign that will have the same background color (and foreground color!) as one's 'colorcolumn' columns could be defined like this...

:sign define mysign text=|> texthl=ColorColumn

From there you don't need to do anything special. When you place a sign it should have the expected coloring. So let's check off some boxes. Are you/have you...

  • Using a recent version of Vim?
  • Making sure the highlight group has set guibg if you are using GUI vim or ctermbg if you're using terminal vim?
  • Defined a sign manually with a "clean" version of vim and known-to-be-working highlight group (check it with :hi HlGroupName)?

(By "clean" I mean you can, for example, start vim without any plugins using vim --noplugin and/or try it without any vimrc file using vim -u NONE.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.