0

Using

" Customize jshint highlights 
hi clear SpellBad
hi SpellBad cterm=underline,bold ctermfg=white ctermbg=black

I was able to customize my jshint SpellBad highlights to the colors I desire when I first open a buffer containing jshint errors. As can be seen here, my background is black and the line with the error is in bold white and underlined. Exactly as I specified using those definitions in .vimrc above.

enter image description here

The problem is, when I switch around between buffers or open a that buffer later again, my custom jshint SpellBad colors no longer apply and I get the "default" colors which I do not want.

enter image description here

Why is this so? And how do I make my custom jshint SpellBad colors stick?

Calvin Cheng
  • 35,640
  • 39
  • 116
  • 167
  • The only thing I can think of is that something changed your color scheme when you switched buffers. I do not believe the custom high lighting should go away just because you changed buffers. – FDinoff Jun 27 '13 at 02:09

1 Answers1

5

Because your custom highlight settings will be cleared after every :colorscheme commands.

try:

autocmd ColorScheme * hi clear SpellBad
    \| hi SpellBad cterm=underline,bold ctermfg=white ctermbg=black
ernix
  • 3,442
  • 1
  • 17
  • 23
  • I see what you mean. But somehow, when I add this to my `.vimrc`, my custom highlights fail completely (does not load even for the first time). – Calvin Cheng Jun 27 '13 at 04:04
  • Please make sure you put the `autocmd` lines before your `colorscheme` setting in `.vimrc`. – ernix Jun 27 '13 at 04:14
  • Ok. Placing the `autocmd` lines before `colorscheme` allows the first load to work fine; but subsequent switch in buffers still result in my custom highlights for `SpellBad` reverting to the "default" pinkish colors. – Calvin Cheng Jun 27 '13 at 04:16
  • That's odd. Could you paste your entire `.vimrc` please? – ernix Jun 27 '13 at 04:20
  • ok, I got it. Remove the section labeled `This caters for the scenario when vimdiff is called while inside a vim buffer` from your `.vimrc`, then it works. – ernix Jun 27 '13 at 05:05