diff and cvs diff is very important when programming; BTW, their output is not such user-friendly, even you use diff -urpN or diff -y or cvs diff -uRpN. Sometime you may hope to redirect their output to a text file and further more edit with VI; but this is not perfect since you need to run 2 different programs for a single simple task. At this moment, colordiff will be a good choice for you. Manual message from man colordiff:
colordiff is a wrapper for diff and produces the same output as diff but with coloured syntax highlighting at the command line to improve readability. The output is similar to how a diff-generated patch might appear in Vim or Emacs with the appropriate syntax highlighting options enabled. The colour schemes can be read from a central configuration file or from a local user ~/.colordiffrc file.
Install colordiff in Debian etch is very simple. Just run this command:
apt-get install colordiffTo test its powerful effect, let's compare 2 file with:
diff -urpN a.txt b.txt | colordiff | less -RFor sure that you can combine it with cvs diff, too. E.g.:
cvs diff -uRpN . | colordiff | less -RSo our next question should be: howto fully utilize colordiff in order to decrease our workload? Some simple bash shell script alias will give us a very handy help. Edit your ~/.bash_profile and add the following 2 lines, so replace diff as colordiff as default, and always display color with less:
alias diff='colordiff'
alias less='less -R'The case of
cvs diffis a bit more complicated. Here suggest for a handy function wrapper for simplify the work (Well, this seems not my cup of tea...). Add this to your~/.bash_profileand runcvsdiffas replacement ofcvs diff:
function cvsdiff () { cvs diff $@ | colordiff; }


















Post new comment