Question

vimdiff shows differences between two or more of same files. Is it possible to see differences of two pairs of files. For eg, when viewing differenes in .H files and .C file, it will be convenient to go back and forth to see the differences. One way is to open old.C new.C old.H new.H using vim and then splitting them and running :diffthis in each buffer. Is there a better way?

Was it helpful?

Solution

When you use vimdiff, it'll diff all passed files together. To get pairwise diffing, pass and arrange the pairs in separate tab pages:

vim -c "edit old.C" -c "diffsplit new.C" -c "tabedit old.H" -c "diffsplit new.H"

If you do this often, you can write an alias / script wrapper for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top