diff --git a/fish/functions/cvsd.fish b/fish/functions/cvsd.fish new file mode 100644 index 0000000..841e3ae --- /dev/null +++ b/fish/functions/cvsd.fish @@ -0,0 +1,11 @@ +function cvsd --wraps 'cvs diff' + if type -q colordiff + command cvs diff -uN $argv | colordiff | less -FRX + else + set -l red (tput setaf 1) + set -l green (tput setaf 2) + set -l reset (tput sgr0) + cvs diff -uN $argv | sed "s/^+.*\$/$green&$reset/" | + sed "s/^-.*\$/$red&$reset/" | less -FRX + end +end diff --git a/fish/functions/fld.fish b/fish/functions/fld.fish index 20a675b..d083da9 100644 --- a/fish/functions/fld.fish +++ b/fish/functions/fld.fish @@ -1,5 +1,5 @@ function fld --wraps 'fossil diff' - if type -q colordiff2 + if type -q colordiff command fossil diff -N $argv | colordiff | less -FRX else set -l red (tput setaf 1) diff --git a/zshrc b/zshrc index 3a0962a..1ad3890 100644 --- a/zshrc +++ b/zshrc @@ -299,6 +299,20 @@ if which fossil &>/dev/null; then } fi +if which cvs &>/dev/null; then + cvsd() { + if which colordiff &>/dev/null; then + cvs diff -uN "$@" | colordiff | less -FRX + else + red="$(tput setaf 1)" + green="$(tput setaf 2)" + reset="$(tput sgr0)" + cvs diff -uN "$@" | sed "s/^+.*$/$green&$reset/" | + sed "s/^-.*$/$red&$reset/" | less -FRX + fi + } +fi + # pkgsrc does not like MAKEFLAGS including -j which pkg_chk &>/dev/null && alias pkg_chk="MAKEFLAGS= pkg_chk" which pkg_rolling-replace &>/dev/null &&