
Untitled
By: a guest on
May 30th, 2012 | syntax:
None | size: 0.75 KB | hits: 12 | expires: Never
taking diff between two named files in vim
"diff between foo.txt and bar.txt found"
:edit file1.txt
:vert diffsplit file2.txt
:tabedit file1.txt
:vert diffsplit file2.txt
diffprogram | grep -w '^diff between' | grep 'found$' |
while read diff between file1 and file2 found;
do
gvim -d "$file1" "$file2"
done
gvim --servername GVIM --remote-silent +"tabedit $file1" +"vert diffsplit $file2"
function s:OpenDiff()
let line=getline('.')
let match=matchlist(line, 'v^ {4}"diff between (.{-}) and (.{-}) found" $')[1:2]
if empty(match)
throw 'Incorrect line:' line
endif
execute 'tabedit' fnameescape(match[0])
execute 'diffsplit' fnameescape(match[1])
endfunction
nnoremap ,od :<C-u>call <SID>OpenDiff()<CR>