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 ?
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.
You can jump to the "next difference" ( ] c ), but this will jump to the next line with a difference.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With