I want to set colorscheme during vimdiff at startup. Note this colorscheme would be different than Vim's colorscheme.
You can use an auto command to achieve this:
augroup VimDiff autocmd! autocmd VimEnter,FilterWritePre * if &diff | colorscheme default | endif augroup END
FileWritePre in the thread Diff mode only mappings. This event allows you to enable specific settings after Vim started and when diff mode is set, with
:diffthis for example.
If you want to check only once (for
VimEnter is enough but you should get rid of the auto command altogether (as Christian pointed out):
if &diff " setup for diff mode else " setup for non-diff mode endif
:h diff for more details.