Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
cvsvimdiff zshism
- X-seq: zsh-users 11257
- From: Chris Johnson <cjohnson@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: cvsvimdiff zshism
- Date: Fri, 9 Mar 2007 11:12:09 -0500
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
I've just started using cvs to manage some code, and sometimes I want to
compare my working copy of a file to some version in the repository.
cvs diff offers a facility to do this, but I really prefer vim's diff
capabilities. With vim, you can do side by side comparison of files,
changes are highlighted, and so on.
So, in order to make cvs diff work with vimdiff, I wrote the following
function that exploits zsh's tmp file substitution mechanism. It's not
very robust, 'cuz I don't know all the ways to break it yet. But here's
a start:
cvsvimdiff() {
if [[ $# -ne 2 ]] then
print Usage: $0 old_version file >& 2
return 1
fi
# $2 is the name of the working copy, $1 the version to compare to.
# We grab the diff between the working copy and the version using
# cvs, apply the patch to the working copy and send it to stdout,
# and then vimdiff the working copy and the patched working copy.
vimdiff $2 =(patch -R -o /dev/fd/1 $2 =(cvs diff -r $1 $2))
}
--
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author