Am 22.03.2011 19:31, schrieb Malte Forkel:
Am 20.03.2011 06:52, schrieb Ben Schmidt:

No, I don't think you can. Late in that thread there is a workaround for
that, which basically works by using 'diffexpr' to 'intercept' the files
on their way to diff and remove the parts of the lines you don't want to
compare (in your case, everything after the timestamp).


I knew I'd feel stupid. I was just wrong why :-)

Ok, thanks. I still have a little trouble getting my diffexpr right.
Here is what I have done.

Based on vim's diffexpr in my installation (vim 7.3 on Windows 7 64-bit)
and after some experiments I came up with this:

set diffexpr=LogDiff()
function! LogDiff()
   let opt = '-a --binary '
   if&diffopt =~ 'icase' | let opt = opt . '-i ' | endif
   if&diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
   let arg1 = v:fname_in
   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
   let arg2 = v:fname_new
   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
   let arg3 = v:fname_out
   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif

   if !exists("s:call_count")
     let s:call_count = 0
   endif
   let s:call_count = s:call_count + 1

   execute "split " . arg1
   " %s/^\(.\{3}\).*$/\1/
   write
   execute "write! diff_in" . "_" . s:call_count
   bwipeout

   execute "split " . arg2
   " %s/^\(.\{3}\).*$/\1/
   write
   execute "write! diff_new" . "_" . s:call_count
   bwipeout

   let eq = ''
   if $VIMRUNTIME =~ ' '
     if&sh =~ '\<cmd'
       let cmd = '""' . $VIMRUNTIME . '\diff"'
       let eq = '"'
     else
       let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
     endif
   else
     let cmd = $VIMRUNTIME . '\diff'
   endif
   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . '>  ' .
arg3 . eq
endfunction

There are probably many things I still have to learn about vim and vim
scripting. E.g, where do the one-line output files come from? What's
wrong with the substitutions?

Thanks,
Malte

An example that does the diffing with vimscript (diffbyline.vim):

http://groups.google.com/group/vim_use/browse_thread/thread/da3282914a164ee6/e443bb7c92f5b2dc

--
Andy

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

Reply via email to