Recursive diffs in Vim
I was working on a project recently that had a number of minor changes between revisions (a client of ours had made minor changes to a project we produced, keeping it under their own version control system), and I needed to sync these changes with a local copy. Since all of these changes were minor, and there were pieces in both versions I wanted to preserve, I would need to do diffs/merges by hand across each of the files (there were about two dozen). Well, diff/edit/close/repeat doesn’t sound like much fun, so I thought a more streamlined approach was necessary.
My favorite command-line editor is vim - no, I don’t mean to start a war here - and I knew I’d be using it quite a bit in merging these changes. In coming up with a streamlined approach, I found a vim plugin that does recursive diffs, splitting the screen up to show differences between each of the files, and allowing for streamlined sync’s in the process. The plugin is called DirDiff, and is written by William Lee, and it proved very useful.
To install, just download the plugin, and place it in your ~/.vim/plugin directory (create it, if you don’t already have one). Once installed, open vim and type :DirDiff [directory1] [directory2]. It found and diff’d each of the files in the directories correctly. It also has a nice feature of sync’ing files, one from the other, based on what you choose. I would have liked more advanced merge capabilities, as I couldn’t take chunks from one file and have them merge into the other, but in most cases, the plugin proved very useful.














