Sunday, September 9, 2018

How to use my own diff tool ?

Hello

I am struggling at comparing xml file (vim -d file1.xml file2.xml). Usual GNU diff does not produce useful data. So I am looking to use my custom and structure aware diff tool with vim. Because viewing difference is still a concern and vim allow to do that.

So I follow the manual notes and put following lines in my .vimrc:

set diffexpr=MyDiff()

function MyDiff()
silent execute '!my_custom_diff '. v:fname_in . ' ' . v:fname_new . ' > ' .v:fname_out
endfunction

But all my trial finish by "E97: Cannot create diffs" message. While my_custom_diff in standalone produce an output compatible to what GNU diff can produce...
I end up to search this message in the vim source code and found that vim prior to run the diff on user's files is performing a sanity check of the diff command with pattern: "line1\n" compare to "line2\n" (source code comment refer to "quick test")
My custom tool is unable to produce the expected result since it must run exclusively on xml file.

I did not found any way to bypass this "quick test". Is there a way ?
Is my use case valid ? I mean the usage of a diff tool not correctly answering to the "quick test" procedure ?

Thanks for your help and comment.
Thomas

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment