Here is the relevant part of my .vimrc
which deals with vimdiff
. Annoyingly, but maybe necessarilly, vimdiff
uses a lot of different options to normal vim
.
" Disable folding
set diffopt+=context:99999
" Disable diffing on whitespace
set diffopt+=iwhite
" Softwrap lines
au VimEnter * if &diff | execute 'windo set wrap' | endif
" Disable syntax highlighting
if &diff
syntax off
endif
" Change highlight colours so they are less garish
hi DiffAdd cterm=none ctermfg=NONE ctermbg=Red
hi DiffChange cterm=none ctermfg=NONE ctermbg=Gray
hi DiffDelete cterm=none ctermfg=NONE ctermbg=Red
hi DiffText cterm=none ctermfg=NONE ctermbg=DarkGray
Ordinarily, if large chunks of the two diffed files are identical, they are folded away to avoid distraction. I don’t actually like that, I get confused about where in the document I am, so I disable it with set diffopt+=context:99999
.
Diffing on whitespace is almost always a bad idea, so that’s disabled by default.
By default, lines in vimdiff run off the edge of the page, which makes it difficult to see differences between files. That’s dumb, so softwrap is used instead.
When syntax highlighting is used there are too many conflicting colours on the page, making it hard to follow what needs to be changed, so syntax highlighting is disabled.
Finally, to further help with the super bright colours, I redefine the colours used show differences between files, so only the background colours are changed. This way the colours are never too loud even with different colour schemes.