I am trying to compare two assembly files where one was written all caps and the other in lowercase. Many lines are identical up to case and whitespace.
I tried the following, while two buffers in diff mode:
:set diffopt+=icase
:set diffopt+=iwhite
:diffupdate
The whitespace thing seems to work well, but the ignore case does not do its work. For example, in the following two lines:
I0=R0; // ADDRESS OF INPUT ARRAY
i0 = r0; // address of input array
[the first line begins with 12 spaces, the second with a single tab]
Why? What can I do?
UPDATE: just noticed that in these two lines all differences were ignored OK:
// MULTIPLY R1 BY 4 TO FETCH DATA OF WORD LENGTH
// multiply r1 by 4 to fetch data of word length
Your comparison is failing because of the whitespace, not because of the case. This is happening because when you use the
iwhite
option, in the background, vimdiff is executing adiff -b
which is more restrictive about how it compares whitespace than what you're looking for. More specifically, the-b
option only ignores differences in the amount of whitespace where there already is whitespace. In your example,i0 = r0;
is being flagged as different thanI0=R0;
because one contains whitespace between the characters and the other doesn't.According to the vimdiff documentation, you can override the default behavior of the
iwhite
option by settingdiffexpr
to a non-empty value. The diff flag that you're interested in is--ignore-all-space
, which is more flexible about whitespace. You can change thediffexpr
in vimdiff to use this option instead of the default-b
option as follows:See the documentation for more details:
http://vimdoc.sourceforge.net/htmldoc/options.html#%27diffopt%27