27

Is there any way to quickly disable/enable color coding in vimdiff ? The problem is, I have colored text in vim and the text is invisible is the text-color is Red, and the vimdiff too tries to put a background color of Red, making it hard to read.

So, I would like to disable the color coding for sometime, for verifying the text and re-enable it later. Any quick, easy way to do this?

1

6 Answers 6

20

You can easily deactivate the coloring in vim

:diffoff!

And to turn it on again

:windo diffthis
2
  • 6
    This does not disable/enable color coding. It turns diff mode off and on. Oct 7, 2016 at 23:02
  • @Mihai My answer addresses the issue that is raised in te body of the question. The title does not fully reflect this
    – Bernhard
    Oct 8, 2016 at 16:35
18

put this in your .vimrc:

if &diff
    syntax off
endif

what it does is disable syntax highlighting if you start in diff mode.

15

Syntax highlighting in vim can be turned off/on with :syntax off and :syntax on.

7

For me, editing the number of supported colors (see :help t_Co) is the solution:

set t_Co=0

Difference highlighting has problems with colouring (like yellow on white), whether syntax highlighting is enabled or not.

Difference highlighting, which is the point of vimdiff, still works with this option, but simply as inverse video which is readable here.

You can tune with other options mentioned before but this fixes the readability problem.

5

TERM=vt100 vimdiff should invoke vimdiff with a TERM temporarily set to vt100. (until the command finishes). This makes it easy to try others : xterm or xterm-color or xterm-256color , etc.

3

You could fix the red color problem by adding the following to your ~/.vimrc:

highlight! link DiffText Todo

Credit: https://stackoverflow.com/a/13370967/200234

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .