Improved handling of color diff.

main
Sorin Ionescu 13 years ago
parent 2679db1ffb
commit fb26ff880c

@ -80,17 +80,27 @@ fi
# Diff/Make # Diff/Make
if zstyle -t ':omz:alias:diff' color; then if zstyle -t ':omz:alias:diff' color; then
if (( $+commands[colordiff] )); then function diff() {
alias diff='colordiff -u' if (( $+commands[colordiff] )); then
compdef colordiff=diff "$commands[diff]" --unified "$@" | colordiff --difftype diffu
elif (( $+commands[git] )); then elif (( $+commands[git] )); then
function diff() { git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
git --no-pager diff --color=always --no-ext-diff --no-index "$@"; else
} "$commands[diff]" --unified "$@"
compdef _git diff=git-diff fi
else }
alias diff='diff -u'
fi function wdiff() {
if (( $+commands[wdiff] )) && (( $+commands[colordiff] )); then
"$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps | colordiff --difftype wdiff
elif (( $+commands[git] )); then
git --no-pager diff --color=auto --no-ext-diff --no-index --word-diff "$@"
elif (( $+commands[wdiff] )); then
"$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps
else
print "zsh: command not found: $0" >&2
fi
}
if (( $+commands[colormake] )); then if (( $+commands[colormake] )); then
alias make='colormake' alias make='colormake'

Loading…
Cancel
Save