Customize vimdiff color scheme

vim_compvimdiff’s default color scheme is not everyone’s cup of tea. However, it is such a powerful and useful tool that I end up using it frequently. Here’s the¬†snippet from my .vimrc file to customize the vimdiff default color scheme.¬†You can play around with the colors to find a color scheme soothing to your eyes.

highlight DiffAdd cterm=none ctermfg=fg ctermbg=Blue gui=none guifg=fg guibg=Blue
highlight DiffDelete cterm=none ctermfg=fg ctermbg=Blue gui=none guifg=fg guibg=Blue
highlight DiffChange cterm=none ctermfg=fg ctermbg=Blue gui=none guifg=fg guibg=Blue
highlight DiffText cterm=none ctermfg=bg ctermbg=White gui=none guifg=bg guibg=White

Sometimes, this script may fail as in some terminals like a putty connection, vim fails to identify the bg and fg colors. For that, explicitly set the color scheme before the above snippet:

highlight Normal term=none cterm=none ctermfg=White ctermbg=Black gui=none guifg=White guibg=Black

3 thoughts on “Customize vimdiff color scheme”

  1. 2 files to edit
    Error detected while processing /home/nousilal/.vimrc:
    line 17:
    E419: FG color unknown
    line 18:
    E419: FG color unknown
    line 19:
    E419: FG color unknown
    line 20:
    E420: BG color unknown
    Press ENTER or type command to continue

    how to disable above warnings

    1. How about the part where it says: “this script may fail as in some terminals like a putty connection, vim fails to identify the bg and fg colors.” in the article?
      Place the second snippet above the first one.

Leave a Reply

Your email address will not be published. Required fields are marked *