Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:20:38+00:00 2026-06-13T13:20:38+00:00

I have a vim highlight to display whitespace errors in code: Highlight redundant whitespaces

  • 0

I have a vim highlight to display whitespace errors in code:

" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/

Which displays trailing whitespace problems like this:
White space errors highlighted in red

However, i’ve recently started using the solarized color scheme and I am not able to get these highlights to display.
solarized with no highlights

I’ve tried changing the color names to no avail. The relevant part of my (simple) .vimrc says:

syntax enable
set background=dark
colorscheme solarized
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:20:39+00:00Added an answer on June 13, 2026 at 1:20 pm

    Moving the :highlight after the :colorscheme still doesn’t help you when you switch colorschemes in the Vim session.

    For that to work, re-define your highlighting via the ColorScheme event:

    autocmd ColorScheme * highlight RedundantSpaces ctermbg=red
    

    BTW, your minimalistic solution has other problems:

    1. It does not highlight in split windows.
    2. You lose the ability of quickly highlighting custom stuff via :match.

    There are several plugins that offer this functionality, in a better way. Mine is called ShowTrailingWhitespace; the plugin page contains links to alternatives.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in ~/.vim/ftplugin/python.vim to highlight long lines, accidental tabs and extra
I'd like to have vim highlight entire lines that match certain patterns. I can
Depending on my task in Vim I have several tabs open. How can I
I have seen this a lot in code, even vim marks it as a
If I have Vim 7.3 installed via Macports which is in opt/local, would my
I have an automatic replacement done by my vim setup, which systematically replaces all
I have some .c files that don't automatically highlight in vim. This problem only
I found the following code that will highlight all unnecessary whitespace, but I really
In vim I am trying to have it highlight my screen when it goes
I have a custom XML file format which can contain blocks of code within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.