views:

763

answers:

2

Scenario: I have opened Vim and pasted some text. I open a second tab with :tabe and paste some other text in there.

Goal: I would like a third tab with a output equivalent to writing both texts to files and opening them with vimdiff.

Currently I the close I can find is "diff the current buffer against a file", but not diffing two open but unsaved buffers.

+8  A: 

I would suggest trying :diffthis or :diffsplit

joeslice
`:vert diffsplit` makes for a more traditional diff-view than without `:vert`
ephemient
You can :set diffopt+=vertical to make :vert the default.
graywh
+5  A: 

I suggest opening the second file in the same tab instead of a new one.

Here's what I usually do:

:edit file1
:diffthis
:vnew
:edit file2
:diffthis

The :vnew command splits the current view vertically so you can open the second file there. The :diffthis (or short: :difft) command is then applied to each view.

Jan
Ah, I didn't know about `vnew` either, good tip!
Dave Tapley