Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim highlighting everything in red

Tags:

python

vim

vi

I added a print line to a python script while the script was executing, and now all the text is highlighted in red when I open the file. Opening and closing the file doesn't get rid of it. Opening a second python file momentarily fixed the problem, but then closing file and reopening brought the problem back. Now it wont go away at all. Any body know what could cause this?

like image 301
David Mulder Avatar asked May 25 '11 19:05

David Mulder


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 I turn off highlighting in vim?

:set invhlsearch will disable the highlighting if its already highlighted and enable it if it isn't. You can map it to say Shift-H.

How do you highlight text in vim?

If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.


2 Answers

This happens sometimes in vim when it goes to highlight syntax on multi-line comments. Occasionally everything after the multi-line comment also becomes colored the same as the comment.

I am unsure whether this is a legit bug in vim, or in the actual syntax settings for Python (e.g. python.vim), but I definitely experience this from time-to-time.

like image 86
jathanism Avatar answered Sep 21 '22 18:09

jathanism


Old thread, but hope this helps.

By mistake I did a "/." on my vim screen, which highlighted all lines in red. If I open any other file, the red highlighting stays.

Try searching for some other keyword, let's say "/word" - doesn't matter word exists or not. It restores the color.

like image 44
rhel.user Avatar answered Sep 23 '22 18:09

rhel.user