COLORDIFF(1)

πŸ“¦
version 1.20230122build1 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’… COLORDIFF β€” a tool to colorize diff output ✨

okay bestie, so colordiff?? it's literally a manual page from the User Commands girlies, and it's about to become your new obsession πŸŽ€


🌈 NAME 🌈

colordiff β€” a tool to colorize diff output πŸ’–


✨ SYNOPSIS ✨

colordiff [diff options] [colordiff options] {file1} {file2}

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” colordiff is a wrapper for diff, and it produces the same output as diff except with coloured syntax highlighting at the command line, which makes everything so much more readable. it's giving "Vim or Emacs with the syntax highlighting options turned on," no cap. the colour schemes can be read from a central configuration file or from a local user ~/.colordiffrc file. πŸ‘‘

colordiff makes use of ANSI colours, and because of that it will only work when ANSI colours can be used β€” typical examples are xterms and Eterms, as well as console sessions. πŸ’€ (if your terminal can't do ANSI, she can't serve.)

colordiff has been tested on various flavours of Linux and under OpenBSD, but should be broadly portable to other systems. periodt. 🌍


πŸ’« USAGE πŸ’«

use colordiff wherever you would normally use diff, or instead pipe output to colordiff:

for example:

$ colordiff file1 file2
$ diff -u file1 file2 | colordiff

you can pipe the output to less, using the -R option (some systems or terminal types may get better results using -r instead), which keeps the colour escape sequences β€” otherwise displayed incorrectly or discarded by less:

$ diff -u file1 file2 | colordiff | less -R

if you want to force disable colour escape sequences (for example, pipe the output to patch), you can use option --color=no to do so:

$ diff -u file1 file2 | colordiff --color=no | patch -p0 -d another-working-dir

if you have wdiff installed, colordiff will correctly colourise the added and removed text, provided that the -n option is given to wdiff:

$ wdiff -n file1 file2 | colordiff

you may find it useful to make diff automatically call colordiff. add the following line to ~/.bashrc (or equivalent):

alias diff=colordiff

any options passed to colordiff are passed through to diff except for the colordiff-specific option difftype, e.g.

colordiff --difftype=debdiff file1 file2

valid values for difftype are: diff, diffc, diffu, diffy, wdiff, debdiff; these correspond to plain diffs, context diffs, unified diffs, side-by-side diffs, wdiff output and debdiff output respectively. 🫢 use these overrides when colordiff is not able to determine the diff-type automatically.

alternatively, a construct such as cvs diff SOMETHING | colordiff can be included in ~/.bashrc as follows:

function cvsdiff () { cvs diff $@ | colordiff; }

or, combining the idea above using less:

function cvsdiff () { cvs diff $@ | colordiff |less -R; }
note that the function name, cvsdiff, can be customized. πŸ’…

by default colordiff returns the exit code of the underlying diff invocation (if there is one), but there are some circumstances where it is useful to force colordiff's exit code to be zero: to do this use the option --fakeexitcode:

colordiff --fakeexitcode ...

πŸŽ€ OPTIONS πŸŽ€

colordiff will send most options through to diff, but there are various colordiff-specific options which can be used:

  • --help β€” show these colordiff-specific options πŸ™‹β€β™€οΈ
  • --color=(yes|no) β€” force (or suppress) display of colours in output 🌈
  • --color=patches=(yes|no) β€” force (or suppress) inclusion of colour codes in patch output 🩹
  • --color-term-output-only β€” force colour to only appear in terminal output πŸ’»
  • --difftype=DIFFTYPE β€” force difftype detection to specified format. DIFFTYPE can be: diff, diffc, diffu, diffy, debdiff, wdiff πŸ”
  • --(no)banner β€” show (or suppress) the colordiff banner 🎏

πŸ“ FILES πŸ“

  • /etc/colordiffrc β€” central configuration file. user-specific settings can be enabled by copying this file to ~/.colordiffrc and making the appropriate changes. πŸ“
  • colordiffrc-lightbg β€” alternate configuration template for use with terminals having light backgrounds. copy this to /etc/colordiffrc or ~/.colordiffrc and customize. 🌀️
  • colordiffrc-gitdiff β€” alternate configuration template for use with terminals having dark backgrounds, with colour defaults set to match the output of git diff. copy this to /etc/colordiffrc or ~/.colordiffrc and customize. πŸŒ™

πŸ› BUGS πŸ›

bug reports and suggestions/patches to <davee@sungate.co.uk> please. πŸ’Œ (yes that's the real address, don't @ me)


πŸ‘‘ AUTHORS πŸ‘‘

  • Dave Ewart β€” colordiff author and Debian packager
  • Graham Wilson β€” manual page and XML source author
  • Colin Tuckley β€” Debian package sponsor

and that's the whole vibe check, bestie πŸ’– this page is from the colordiff girlies, version stamped 12/22/2022, and it ate, no crumbs. go forth and colour your diffs πŸŒˆβœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from