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?

mtk
  • 26,802
  • 35
  • 91
  • 130
  • 1
    Related: [Load a different vimdiff color scheme](http://stackoverflow.com/questions/2019281/load-different-colorscheme-when-using-vimdiff) – belacqua Sep 10 '13 at 17:46

6 Answers6

20

You can easily deactivate the coloring in vim

:diffoff!

And to turn it on again

:windo diffthis
Bernhard
  • 11,992
  • 4
  • 59
  • 69
18

put this in your .vimrc:

if &diff
    syntax off
endif

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

hildred
  • 5,759
  • 3
  • 30
  • 43
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.

Benoit Duffez
  • 475
  • 5
  • 13
Fred
  • 71
  • 1
  • 1
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.

Olivier Dulac
  • 5,924
  • 1
  • 23
  • 35
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

Mihai Capotă
  • 233
  • 1
  • 5