Re: Ignoring C comments with diffexpr
- On 2011-10-31, subhash wrote:
> Hi,Here's what I've done in my ~/.vimrc to add the -d option to diff on
> Could someone help me understand how to set up diffexpr variable in
> vim (by defining my own diff function) so that I can ignore C comments
> while diff'ing. (i.e. // or /* .... */). There seems to be a way in "
> diff -I RE ..., " but I am not able to figure it out by myself. Would
> be great if someone can actually give a snippet of their function as
> an example.
Unix. I used the MyDiff() function in the default Windows _vimrc as
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
if &diffopt =~ "iwhite"
let opt = opt . "-b "
silent execute "!diff -d -a --binary " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
As an experiment, I modified the line containing the diff command to
add this option:
As a result, lines beginning with // but containing different text
in two test files were not highlighted as different by vimdiff.
However, in the time I allowed myself, I couldn't refine the regular
expression to match only comment lines or to match /* and */. I
hope this is of some help anyway.
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php