3

Im running terminal vim, and when a syntax highlighted file is loaded and I have a colorscheme active and I run this command

:hi Normal ctermbg=2 ctermfg=0

ALL text in the window changes, not just text belonging to the Normal group changes. It looks like alot of it reverts back to the vim default 8 color terminal colors.

Is there something special about Normal does setting it trigger some autocommand that resets all syntax?

Why does modifying the Normal highlight group colors affect all these other highlight groups?

3

:h :hi-normal-cterm

When setting the "ctermfg" or "ctermbg" colors for the Normal group, these will become the colors used for the non-highlighted text.

This is the same case for guifg and guibg, but, it's assumed you already know this in :h :hi-normal

If you are running in the GUI, you can get white text on a black background with:

:highlight Normal guibg=Black guifg=White

Normal is the base highlight group. Any highlight that doesn't define a field inherits Normal's. For example, run :highlight, and you will see that not everything defines ctermfg or ctermbg. For groups that don't define ctermbg, they will take Normal's ctermbg=2. If Normal doesn't define that field, it won't set a background color and your terminal's background will show through.

ALL text in the window changes, not just text belonging to the Normal group changes.

Normal is not defined by syntax. It's a highlight for normal, unstyled text.

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.