• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

t/H03-May-2022-

LICENSEH A D03-May-2022357 97

README.mdH A D27-Mar-20178 KiB294190

cdifH A D03-May-202229.7 KiB1,347885

cdif.elH A D27-Mar-2017976 3022

README.md

1# CDIF
2
3### is word context visualizer of DIFF output
4
5### for ANSI color terminal
6
7[![cdif](http://cdn-ak.f.st-hatena.com/images/fotolife/u/uta46/20140110/20140110150042.gif)](http://cdn-ak.f.st-hatena.com/images/fotolife/u/uta46/20140110/20140110150042.gif)
8
9# Side-by-side view
10
11### power by SDIF command
12
13[![default](http://kaz-utashiro.github.io/sdif/images/screen-shot-default.jpg)](http://kaz-utashiro.github.io/sdif/images/screen-shot-default.jpg)
14
15
16# International
17
18### Unicode
19
20### East Asian wide width character
21
22### Japanese Kanji/Hiragana/Katakana separation
23
24[![japanese](http://kaz-utashiro.github.io/sdif/images/screen-shot-japanese.jpg)](http://kaz-utashiro.github.io/sdif/images/screen-shot-japanese.jpg)
25
26
27# Japanese syllable tokenizer
28
29### --mecab morphology
30
31[![mecab](http://kaz-utashiro.github.io/sdif/images/screen-shot-mecab.jpg)](http://kaz-utashiro.github.io/sdif/images/screen-shot-mecab.jpg)
32
33[![mecab](http://kaz-utashiro.github.io/sdif/images/screen-shot-mecab-comp.jpg)](http://kaz-utashiro.github.io/sdif/images/screen-shot-mecab-comp.jpg)
34
35
36# Using inside Emacs
37
38[![emacs](http://cdn-ak.f.st-hatena.com/images/fotolife/u/uta46/20140403/20140403170919.png)](http://cdn-ak.f.st-hatena.com/images/fotolife/u/uta46/20140403/20140403170919.png)
39# NAME
40
41cdif - word context diff
42
43# SYNOPSIS
44
45cdif \[cdif option\] file1 file2
46
47cdif \[rcs options\] \[cdif options\] file
48
49cdif \[cdif options\] \[diff-data\]
50
51Options:
52
53        -c, -Cn         context diff
54        -u, -Un         unified diff
55        -i              ignore case
56        -b              ignore trailing blank
57        -w              ignore whitespace
58        -t              expand tabs
59        -T              initial tabs
60        --rcs           use rcsdiff
61        -r<rev>, -q     rcs options
62
63        -B                  char-by-char comparison
64        -W                  specify terminal width
65        --diff=command      specify diff command
66        --stat              show statistical information
67        --colormap=s        specify color map
68        --[no]color         color or not            (default true)
69        --[no]256           ANSI 256 color mode     (default true)
70        --[no]commandcolor  color for command line  (default true)
71        --[no]markcolor     color for diff mark     (default true)
72        --[no]textcolor     color for normal text   (default true)
73        --[no]old           print old text          (default true)
74        --[no]new           print new text          (default true)
75        --[no]command       print diff command line (default true)
76        --[no]unknown       print unknown line      (default true)
77
78# DESCRIPTION
79
80**cdif** is a post-processor of the Unix diff command.  It highlights
81deleted, changed and added words based on word context.
82
83You may want to compare character-by-character rather than
84word-by-word.  Option **-B** option can be used for that purpose.
85
86If only one file is specified, cdif reads that file (stdin if no file)
87as a output from diff command.
88
89Lines those don't look like diff output are simply ignored and
90printed.
91
92# OPTIONS
93
94- **-**\[**cCuUibwtT**\]
95
96    Almost same as **diff** command.
97
98- **--rcs**, **-r**_rev_, **-q**
99
100    Use rcsdiff instead of normal diff.  Option **--rcs** is not required
101    when **-r**_rev_ is supplied.
102
103- **-B**, **--char**
104
105    Compare the data character-by-character context.
106
107- **-W** _width_, **--width**=_width_
108
109    Explicitly specify terminal width.
110
111- **--diff**=_command_
112
113    Specify the diff command to use.
114
115- **--**\[**no**\]**color**
116
117    Use ANSI color escape sequence for output.
118
119- **--colormap**=_colormap_, **--cm**=_colormap_
120
121    Basic _colormap_ format is :
122
123        FIELD=COLOR
124
125    where the FIELD is one from these :
126
127        COMMAND  Command line
128        OMARK    Old mark
129        NMARK    New mark
130        OTEXT    Old text
131        NTEXT    New text
132        OCHANGE  Old change part
133        NCHANGE  New change part
134        APPEND   Appended part
135        DELETE   Deleted part
136
137    and additional _Common_ and _Merged_ FIELDs for git-diff combined
138    format.
139
140        CMARK    Common mark
141        CTEXT    Common text
142        MMARK    Merged mark
143        MTEXT    Merged text
144
145    You can make multiple filelds same color joining them by = :
146
147        FIELD1=FIELD2=...=COLOR
148
149    Also wildcard can be used for field name :
150
151        *CHANGE=BDw
152
153    Multiple fields can be specified by repeating options
154
155        --cm FILED1=COLOR1 --cm FIELD2=COLOR2 ...
156
157    or combined with comma (,) :
158
159        --cm FILED1=COLOR1,FIELD2=COLOR2, ...
160
161    COLOR is combination of single character representing uppercase
162    foreground color :
163
164        R  Red
165        G  Green
166        B  Blue
167        C  Cyan
168        M  Magenta
169        Y  Yellow
170        K  Black
171        W  White
172
173    and alternative (usually brighter) colors in lowercase :
174
175        r, g, b, c, m, y, k, w
176
177    or RGB values and 24 grey levels if using ANSI 256 or full color
178    terminal :
179
180        FORMAT:
181            foreground[/background]
182
183        COLOR:
184            000 .. 555       : 6 x 6 x 6 216 colors
185            000000 .. FFFFFF : 24bit RGB mapped to 216 colors
186            L00 .. L23       : 24 grey levels
187
188        Sample:
189            005     0000FF        : blue foreground
190               /505       /FF00FF : magenta background
191            000/555 000000/FFFFFF : black on white
192            500/050 FF0000/00FF00 : red on green
193
194    and other effects :
195
196        S  Standout (reverse video)
197        U  Underline
198        D  Double-struck (boldface)
199        F  Flash (blink)
200        E  Expand (only for command line)
201
202    When **E** is specified for command line, the line is expanded to
203    window width filling up by space characters.
204
205    Defaults are :
206
207        COMMAND => "SE"
208        OMARK   => "CS"
209        NMARK   => "MS"
210        OTEXT   => "C"
211        NTEXT   => "M"
212        OCHANGE => "BD/445"
213        NCHANGE => "BD/445"
214        DELETE  => "RD/544"
215        APPEND  => "RD/544"
216
217        CMARK   => "GS"
218        MMARK   => "YS"
219        CTEXT   => "G"
220        MTEXT   => "Y"
221
222    This is equivalent to :
223
224        cdif --cm 'COMMAND=SE,OMARK=CS,NMARK=MS' \
225             --cm 'OTEXT=C,NTEXT=M,*CHANGE=BD/445,DELETE=APPEND=RD/544' \
226             --cm 'CMARK=GS,MMARK=YS,CTEXT=G,MTEXT=Y'
227
228- **--**\[**no**\]**commandcolor**, **--cc**
229- **--**\[**no**\]**markcolor**, **--mc**
230- **--**\[**no**\]**textcolor**, **--tc**
231
232    Enable/Disable using color for the corresponding field.
233
234- **--**\[**no**\]**old**, **--**\[**no**\]**new**
235
236    Print or not old/new text in diff output.
237
238- **--**\[**no**\]**command**
239
240    Print or not command lines preceding diff output.
241
242- **--**\[**no**\]**unknown**
243
244    Print or not lines not look like diff output.
245
246- **--**\[**no**\]**mark**
247
248    Print or not marks at the top of diff output lines.  At this point,
249    this option is effective only for unified diff.
250
251    Next example produces the output exactly same as _new_ except visual
252    effects.
253
254        cdif -U100 --nomark --noold --nocommand --nounknown old new
255
256    These options are prepared for watchdiff(1) command.
257
258- **--stat**
259
260    Print statistical information at the end of output.  It shows number
261    of total appended/deleted/changed words in the context of cdif.  It's
262    common to have many insertions and deletions of newlines becuase of
263    text filling process.  So normal informaiton is followed by modified
264    number which ignores insert/delete newlines.
265
266- **--mecab**
267
268    Experimental option for using **mecab** as a tokenizer.  To use this
269    option, external command **mecab** has to be installed.
270
271# AUTHOR
272
273Kazumasa Utashiro
274
275https://github.com/kaz-utashiro/cdif
276
277# SEE ALSO
278
279perl(1), diff(1), sdif(1), watchdiff(1)
280
281# BUGS
282
283**cdif** is naturally not very fast because it uses normal diff command
284as a backend processor to compare words.
285
286# COPYRIGHT
287
288Use and redistribution for ANY PURPOSE are granted as long as all
289copyright notices are retained.  Redistribution with modification is
290allowed provided that you make your modified version obviously
291distinguishable from the original one.  THIS SOFTWARE IS PROVIDED BY
292THE AUTHOR \`\`AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES ARE
293DISCLAIMED.
294