" -*- vim -*- " FILE: "C:\Documents and Settings\William Lee\vimfiles\plugin\DirDiff.vim" {{{ " LAST MODIFICATION: "Fri, 31 Oct 2003 07:51:17 Central Standard Time" " HEADER MAINTAINED BY: N/A " VERSION: 1.0.2 " (C) 2001-2003 by William Lee, " }}} " PURPOSE: {{{ " - Diffing a directory recursively and enable easy merging, copying and " deleting of files and directories. " " REQUIREMENTS: " - Make sure you have GNU diff in your path on Unix and Windows. I only " tested this on cygwin's version on Windows. If you have a diff that " doesn't support -x or -I flag, do not set variable g:DirDiffExcludes and " g:DirDiffIgnore to "". It should still work. " - On Windows, you need to have "xcopy", "copy", "del", and "rd" in your " path. " - On Unix, you need to have "rm" and "cp" in your path. " " USAGE: " Put this file in your ~/.vim/plugin " " Doing the following will generate a diff window. " " :DirDiff " e.g. " :DirDiff ../something/dir1 /usr/bin/somethingelse/dir2 " " The following commands can be used inside the diff window: " 'Enter','o' - Diff open: open the diff file(s) where your cursor is at " 's' - Synchronize the current diff. You can also select " a range (through visual) and press 's' to synchronize differences " across a range. " " - There are 6 Options you can choose when you hit 's': " 1. A -> B " Copy A to overwrite B " If A's file actually points to a directory, it'll copy it to B " recursively. " 2. B -> A " Copy B to overwrite A " If B's file actually points to a directory, it'll copy it to A " recursively. " 3. Always A " For the rest of the items that you've selected, " synchronize like (1). " 4. Always B " For the rest of the items that you've selected, " synchronize like (2). " 5. Skip " Skip this diff entry. " 6. Cancel " Quit the loop and exit. " " 'u' - Diff update: update the diff window " 'x' - Sets the exclude pattern, separated by ',' " 'i' - Sets the ignore pattern, separated by ',' " 'a' - Sets additional arguments for diff, eg. -w to ignore white space, " etc. " 'q' - Quit DirDiff " " The following comamnds can be used in the Vim diff mode " \dg - Diff get: maps to :diffget " \dp - Diff put: maps to :diffput " \dj - Diff next: (think j for down) " \dk - Diff previous: (think k for up) " " NOTES: " This script can copy and remove your files. This can be powerful (or too " powerful) at times. Please do not blame me if you use this and " disintegrate your hard work. Be warned! " " CREDITS: " " Please mail any comment/suggestion/patch to " " William Lee " " (c) 2001-2003. All Rights Reserved " " THANKS: " " Robert Webb for his sorting function " Salman Halim, Yosuke Kimura, and others for their suggestions " " HISTORY: " 1.0.2 - Fixed a small typo bug in the quit function. " 1.0.1 - Ensure the path separator is correct when running in W2K " 1.0 - Fixed a bug that flags errors if the user use the nowrapscan option. " Implements a quit function that exit the diff windows. " 0.94 - Fixed a bug where the diff will give incorrect A and B file due to " similarity of directory names. Allow you to modify the diff " argument. " 0.93 - Opps, messed up the key mapping usage. " 0.92 - Doesn't use n and p mappings since it confuses the search next key " mapping and causes some bugs. Minor modification to change the " exclude and ignore pattern. " 0.91 - Clean up delete routine. " - Added interactive mode. " - Added multiple entries of exclude and ignore pattern. " - Custom configuration through global variables. " - Change exclude and ignore patterns on the fly. " " 0.9 - Reorganization of the interface. Much simplier dialog for " synchronization. Support for range synchronization option (REALLY " powerful) " - Removed unnecessary key bindings. All key bindings are local to " the diff window. (except for the \dg and \dp) " " 0.8 - Added syntax highlighting. " - Enter and double-click in buffer opens diff. " - Removed dependency on "sort" " - Removed usage of registry and marker " - Code cleanup and some bug fixes " - On Windows the diff command will use the -i flag instead " - Changed mappings for diff next (\dj) and diff previous (\dk) " - Added mappings for vim diff mode (\dg, \dp) " " 0.7 Initial Release " " }}} " Public Interface: command! -nargs=* -complete=dir DirDiff call DirDiff () command! -nargs=0 DirDiffOpen call DirDiffOpen () command! -nargs=0 DirDiffNext call DirDiffNext () command! -nargs=0 DirDiffPrev call DirDiffPrev () command! -nargs=0 DirDiffUpdate call DirDiffUpdate () command! -nargs=0 DirDiffQuit call DirDiffQuit () if !hasmapto('DirDiffGet') map dg DirDiffGet endif if !hasmapto('DirDiffPut') map dp DirDiffPut endif if !hasmapto('DirDiffNext') map dj DirDiffNext endif if !hasmapto('DirDiffPrev') map dk DirDiffPrev endif " Global Maps: map