Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Take diff of two vertical opened windows in Vim

Tags:

vim

diff

vimdiff

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 ?

like image 425
Fatih Arslan Avatar asked Dec 08 '10 08:12

Fatih Arslan


People also ask

How do I open multiple windows in vim?

To split the vim screen horizontally, or open a new workspace at the bottom of the active selection, press Ctrl + w , followed by the letter 's' . In the example below, the left section has been split into two workspaces.

How do you get to the next difference in Vimdiff?

You can jump to the "next difference" ( ] c ), but this will jump to the next line with a difference.


1 Answers

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.)

like image 86
Nefrubyr Avatar answered Oct 08 '22 20:10

Nefrubyr