Take the difference between two vertical open windows in Vim

I have two files open. They open in vertical mode, next to the next. Can I split these two files right away without leaving or closing Vim?

+51
vim diff vimdiff
Dec 08 '10 at 8:35
source share
3 answers

To begin to distinguish all visible windows:

:windo diffthis 

which executes :diffthis in each window.

To end diff mode:

 :diffoff! 

( ! makes diffoff applicable to all windows of the current tab - it would be nice if diffthis had the same function, but it is not.)

+77
Dec 08 '10 at
source share

in each of the windows you want to split:

 :diffthis 

If you want to distinguish between all open windows, you can do:

 :windo diffthis 

( windo apply the command to all open windows)

+15
Dec 08 '10 at 8:40
source share

Following the earlier answers,

  • :windo difft (short for diffthis ) will start diff mode in all open windows.
  • :windo diffo (short for diffoff ) will stop diff mode in all open windows.

I have the following mappings in my vimrc to simplify it:

 command! Difft windo diffthis command! Diffo windo diffoff 
0
Jun 29 '15 at 17:45
source share



All Articles