mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-23 04:28:00 +00:00
Improved handling of color diff.
This commit is contained in:
parent
2679db1ffb
commit
fb26ff880c
32
alias.zsh
32
alias.zsh
@ -80,17 +80,27 @@ fi
|
||||
|
||||
# Diff/Make
|
||||
if zstyle -t ':omz:alias:diff' color; then
|
||||
if (( $+commands[colordiff] )); then
|
||||
alias diff='colordiff -u'
|
||||
compdef colordiff=diff
|
||||
elif (( $+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
|
||||
function diff() {
|
||||
if (( $+commands[colordiff] )); then
|
||||
"$commands[diff]" --unified "$@" | colordiff --difftype diffu
|
||||
elif (( $+commands[git] )); then
|
||||
git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
|
||||
else
|
||||
"$commands[diff]" --unified "$@"
|
||||
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
|
||||
alias make='colormake'
|
||||
|
Loading…
Reference in New Issue
Block a user