2

I have the following text in my ~/.vimrc:

syntax on
colorscheme koehler
highlight ErrorMsg ctermbg=Red ctermfg=Black

however the error messages show like this:

enter image description here

The error message is gray on red, not black on red. How can I get it to display as black?

I know it is reading the commands in my .vimrc because I can change the text color to other colors, it's just that black doesn't show correctly.

I am using iTerm2.

  • 1
    typo ctermfb? BTW: What is the output of :hi ErrorMsg? – Christian Brabandt Oct 26 '19 at 7:15
  • ErrorMsg xxx term=standout cterm=bold ctermfg=0 ctermbg=9 guifg=White guibg=Red – user109923 Oct 26 '19 at 13:20
  • Terminal color number 0 is supposed to be black, might be the bold attribute, else you might need to configure your terminal correctly what colors it uses. – Christian Brabandt Oct 26 '19 at 13:31
  • 1
    filbranden's suggestion of cterm=NONE fixed it. – user109923 Oct 26 '19 at 13:48
2

You should also include:

highlight ErrorMsg cterm=NONE

The cterm attributes often interact with the color settings and can end up having Vim picking a "bright" shade of the color.

The "koehler" theme ships with cterm=bold, which has this effect of using a bright color on many terminals, including iTerm2 (with default settings.)

You can inspect your settings by querying them, with:

:highlight ErrorMsg

I expect you'll see that cterm=bold is included there.

In order to remove that, simply set it to NONE.

You can do all these settings from a single command:

highlight ErrorMsg ctermbg=Red ctermfb=Black cterm=NONE
| improve this answer | |

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.