3

I would like to compare

  • File1-v1.txt with File1-v2.txt

and

  • File2-v1.txt with File2-v2.txt

at the same time. I tried to create the following layout:

+------------------+------------------+
|                  |                  |
|   File1-v1.txt  <=>  File1-v2.txt   |  // scroll synchronized diff
|                  |                  |
+------------------+------------------+
|                  |                  |
|   File2-v1.txt  <=>  File2-v2.txt   |  // *another* scroll synchronized diff
|                  |                  |
+------------------+------------------+

What I get is a 4-way diff, where all four buffers were scroll-synchronozed and compared. That's cool, but it's not what I want in my special case.

How can I configure vim to show me two separate "2-way diff sessions" instead of the one 4-way diff?

PS
This would be particular useful when analysing Git history of two (or more) files.

  • 1
    AFAIK, this isn't possible. Regarding the 2-way/3-way/4-way diff, check Splice plugin. – Luc Hermitte Nov 22 '16 at 17:38
  • 1
    You can use tabpages to view different sets of diffs, as diff are local to the current tab page. See :h diff.txt – Peter Rincker Nov 22 '16 at 17:48
  • @PeterRincker Using multiple tabs looks like acceptable workaround. At least, if using a single vim instance is a constraint. Would you like make an answer out of your suggestion? – Boris Brodski Nov 24 '16 at 10:53
  • 1
    alternatively, if you want exactly that layout and you don't mind having multiple Vim, you could have a tmux/screen split and two independant Vim instance. – nobe4 Nov 28 '16 at 16:52
1

You can use tabpages to view different sets of diffs, as diff are local to the current tab page.

For more information see:

:h diff.txt
:h tabpage
:h gt
1

I'd split the terminal, for instance in konsole: Ctrl-Shift-) Then in each terminal I'd make the corresponding diff.

  • This is a great idea and depending on the situation, it can be very helpful. But most of the time I prefer to have a single instance of vim per project. Thank you. – Boris Brodski Nov 28 '16 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.