asdf
asdf

Reputation: 415

How to remove highlighted background of text in vim?

I am referring to the grey background highlighting which is making vim unreadable. Note - I am running vim on Windows Subsystem for Linux. Also, this is not search highlighting. This is the default view every time I open Vim.

screenshot

It seems it has nothing to do with syntax highlighting. I created a new file named a.txt . On using :syn list , it said no syntax items defined for this buffer, but I still had grey background on every line. screenshot of a.txt

Upvotes: 7

Views: 4562

Answers (4)

JohnnyLo
JohnnyLo

Reputation: 11

I had grey text highlights that were caused by my current syntax highlighting file.

In this case, :syntax off did the trick

Upvotes: 1

JavaPai
JavaPai

Reputation: 11

For anyone coming across this problem now, here is how I was able to fix this issue.

I first realized that what was happening is that the highlight group Normal was not being set for some reason from my theme. If, in the command line, I ran

:highlight Normal ctermfg=NONE

The highlighting would look normal.

The only problem being is that I had to run this after the buffer was entered, so traditional highlighting in the .vimrc was not working.

Adding

func! FixNormal()
    highlight Normal ctermfg=252
endfu
com! Normal call FixNormal()

Then above this function adding

au! BufEnter * Normal

The issue would resolve itself.

Explanation

The code creates a function that when called, does the same command that originally worked (highlighting Normal with None). The function is then called by the autocommand (au!) when the buffer is entered (BufEnter) and runs the function Normal.

Upvotes: 1

asdf
asdf

Reputation: 415

It seems that my default colorscheme - 'evening' had been modified by the last windows update. A workaround is to change the colorscheme to different value - desert/elflord etc seem to be working fine. Note - this is not a solution just a workaround , as you can see there is still grey background highlighting in the top rows.

Upvotes: 3

Ingo Karkat
Ingo Karkat

Reputation: 172698

You need to find out which syntax group causes the highlighting. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. When you have the name of the offending syntax group, you can investigate where it comes from; (the last lines of) :scriptnames may help.

Upvotes: 4

Related Questions