I have setup Vim to highlight trailing whitespace:

set listchars=eol:↵,nbsp:◦,tab:―→,trail:⮿,extends:⮚,precedes:⮘
set list " Show problematic characters.

" Also highlight all tabs and trailing whitespace characters.
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/

This works fine and sets a red highlighted background on trailing whitespace characters.

Is there a way to instead set the foreground color of the text rather than the background? I can't seem to get it to trigger using ctermfg and guifg.

  • You want to change the foreground color of whitespace? – Ignacio Vazquez-Abrams May 18 '18 at 12:08
  • Yes, I want to change the font color. – Naftuli Kay May 18 '18 at 19:23

Your Answer

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

Browse other questions tagged or ask your own question.