Take diff of two vertical opened windows in Vim

Fatih Arslan picture Fatih Arslan · Dec 8, 2010 · Viewed 19.4k times · Source

I've have two files opened. They are opened in vertical mode, next to next. Can I instantly diff these two files without leaving or closing Vim ?

Answer

Nefrubyr picture Nefrubyr · Dec 8, 2010

To begin diffing on all visible windows:

:windo diffthis

which executes :diffthis on each window.

To end diff mode:

:diffoff!

(The ! makes diffoff apply to all windows of the current tab - it'd be nice if diffthis had the same feature, but it doesn't.)