From adb9f379aa8f10b8a4fa45fbbc7d9c4ccb8fdc4d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 16:19:00 -0400 Subject: [PATCH] Use Git for coloured diff if colordiff is not installed. --- functions/alias.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 8dff7aba..03850ead 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -63,11 +63,20 @@ fi if [[ "$DISABLE_COLOR" != 'true' ]]; then if [[ -x "${commands[colordiff]}" ]]; then - alias diff='colordiff' + alias diff='colordiff -u' + compdef colordiff=diff + elif [[ -x "${commands[git]}" ]]; then + function diff() { + git --no-pager diff --color=always --no-ext-diff --no-index "$@"; + } + compdef _git diff=git-diff + else + alias diff='diff -u' fi if [[ -x "${commands[colormake]}" ]]; then alias make='colormake' + compdef colormake=make fi fi