24

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?

17

You can easily deactivate the coloring in vim

:diffoff!

And to turn it on again

:windo diffthis
  • 3
    This does not disable/enable color coding. It turns diff mode off and on. – Mihai Capotă Oct 7 '16 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 '16 at 16:35
12

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

10

put this in your .vimrc:

if &diff
    syntax off
endif

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

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.

4

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.