1COLORDIFF(1) COLORDIFF(1)
2
3
4
6 colordiff - a tool to colorize diff output
7
9 colordiff [diff options] {file1} {file2}
10
11
13 colordiff is a wrapper for diff and produces the same output as diff
14 but with coloured syntax highlighting at the command line to improve
15 readability. The output is similar to how a diff-generated patch might
16 appear in Vim or Emacs with the appropriate syntax highlighting options
17 enabled. The colour schemes can be read from a central configuration
18 file or from a local user ~/.colordiffrc file.
19
20
21 colordiff makes use of ANSI colours and as such will only work when AN‐
22 SI colours can be used - typical examples are xterms and Eterms, as
23 well as console sessions.
24
25
26 colordiff has been tested on various flavours of Linux and under Open‐
27 BSD, but should be broadly portable to other systems.
28
29
31 Use colordiff wherever you would normally use diff, or pipe output to
32 colordiff:
33
34
35 For example:
36
37
38 $ colordiff file1 file2 $ diff -u file1 file2 | colordiff
39
40
41
42 You can pipe the output to 'less', using the '-R' option (some systems
43 or terminal types may get better results using '-r' instead), which
44 keeps the colour escape sequences, otherwise displayed incorrectly or
45 discarded by 'less':
46
47
48 $ diff -u file1 file2 | colordiff | less -R
49
50
51
52 You may find it useful to make diff automatically call colordiff. Add
53 the following line to ~/.bashrc (or equivalent):
54
55
56 alias diff=colordiff
57
58
59
60 Any options passed to colordiff are passed through to diff.
61
62
63 Alternatively, a construct such as 'cvs diff SOMETHING | colordiff' can
64 be included in ~/.bashrc as follows:
65
66
67 function cvsdiff () { cvs diff $@ | colordiff; }
68
69
70
71 Or, combining the idea above using 'less':
72
73
74 function cvsdiff () { cvs diff $@ | colordiff |less -R; }
75
76
77
78 Note that the function name, cvsdiff, can be customized.
79
80
82 /etc/colordiffrc
83 Central configuration file. User-specific settings can be en‐
84 abled by copying this file to ~/.colordiffrc and making the ap‐
85 propriate changes.
86
87
88 colordiffrc-lightbg
89 Alternate configuration template for use with terminals having
90 light backgrounds. Copy this to /etc/colordiffrc or ~/.col‐
91 ordiffrc and customize.
92
93
95 Bug reports and suggestions/patches to <davee@sungate.co.uk> please.
96
97
99 colordiff is written and maintained by Dave Ewart <davee@sun‐
100 gate.co.uk>. This manual page and the source XML was written by Graham
101 Wilson <graham@mknod.org> for Debian and is maintained by the author.
102 Dave Ewart maintains the Debian package, sponsored by Graham Wilson.
103
104
105
106
107 COLORDIFF(1)