Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 205
asdf Avatar asked Aug 02 '17 13:08

asdf


People also ask

How do I change the highlight color in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

How do you highlight text in Vim?

Press 1 to highlight the current visually selected text, or the current word (if nothing is selected). Highlight group hl1 is used. Press 2 for highlight hl2 , 3 for highlight hl3 , etc. Press 0 to remove all highlights from the current visually selected text, or the current word.

What Vim command turns on syntax highlighting?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

How do I un highlight a word in Vim?

Add the following to your . vimrc: :nnoremap <silent> <CR> :nohlsearch<CR><CR> . Hit return in command mode, and the highlighting disappears.


1 Answers

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.

like image 90
Ingo Karkat Avatar answered Nov 12 '22 04:11

Ingo Karkat