Indentation glitch?

As seen from the image, Vim decides to highlight those indentations for no reason. I've tried :noh and :set nolist (:set list seems to make it go away, but I don't want indentation marks) from a related question, but they do not work.

What's causing this issue? All my settings are default, here is my vimrc file:

set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab
color slate

1 Answer 1


This is happening because Vim's HTML syntax will use style htmlHead to the text within the <head> block and it will link it to syntax group PreProc. (The PreProc group is meant for pre-processor directives, such as #include or #define in C/C++.)

The slate colorscheme uses a white background (guibg=white) for the PreProc group, so it ends up styling the whitespace inside <head> that way. It doesn't affect the tags themselves (<meta>, <title>, etc.) because they're styled as htmlTag and text within those tags because they're using more specific styles (for example, htmlTitle) for the title.

One way to fix this is to override HTML syntax highlighting to unlink it from PreProc, which you can do with:

:hi link htmlHead None

If you want to make that permanent, add this command to your vimrc. (This will work because html.vim sets it using hi def link which won't override your settings from your vimrc.)

Another alternative is to override the background color of theme slate, which you can do with:

:hi PreProc guibg=NONE

You can make that stick by adding this command to your vimrc after color slate, but the customization will go away if you change themes and then go back to slate. (See this question about how to override an existing color theme in a somewhat more reliable way.)

  • 2
    I thoroughly recommend @D.BenKnoble's synstax plug-in to debug this type of issue. Very useful to display which syntax style is under the cursor.
    – filbranden
    Nov 24, 2019 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.