" diffwin.vim: a simple way to use diff to compare two source files " and to synchronize the three windows to the current, " next, and previous difference blocks. " " Author : Charles E. Campbell, Jr. (Charles.E.Campbell.1@gsfc.nasa.gov) " Date : 10/20/1999 " " To enable: put this file into your <.vimrc> or source it from there. " You may wish to modify the maps' temporary directory; " its easiest to use vms's version: copy it, then :s/tmp:/newpath/g " " To use: start Vim as shown below, use \df to generate differences, " and then hit the key: " " vim -o newfile oldfile " \df " " " The resulting three windows will look like this: " " +----+ Diff Block Format: " |diff| Old code: *** oldfilename date " +----+ new->old changes " |new | New code: --- newfilename date " +----+ old->new changes " |old | " +----+ " " You can synchronize the files in the new&old windows to the current " difference-block being considered: just move the cursor in the diff " window to the difference of interest and hit the F8 key. Use \dn " and \dp to navigate to the next/previous difference block, respectively. " " Maps: " \df : opens a third window on top with the diff file. " \dc : synchronize windows to current diff " \dn : synchronize windows to next diff " \dp : synchronize windows to previous diff " : same as \dc if has("unix") map \df kj:!diff -c % # > /tmp/vimtmp.difks:e! /tmp/vimtmp.dif:!/bin/rm -f /tmp/vimtmp.dif elseif has("win32") map \df kj:!diff -c % # > vimtmp.difks:e vimtmp.dif:!erase vimtmp.dif elseif has("vms") map \df kj:!diff -c % # > tmp:vimtmp.difks:e! tmp:vimtmp.dif:!/bin/rm -f tmp:vimtmp.dif endif map \dc kk?^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*$jYpdwf,DAGz"aYddjj@akk?^\*\*\*\*/^--- Ypdwf,DAGz"aYddj@akuuz map \dn kk/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*$jYpdwf,DAGz"aYddjj@akk?^\*\*\*\*/^--- Ypdwf,DAGz"aYddj@akuuz map \dp kk?^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*$?jYpdwf,DAGz"aYddjj@akk?^\*\*\*\*/^--- Ypdwf,DAGz"aYddj@akuuz map \dc " vim:ts=4