LookAheadAtYourTypes
LookAheadAtYourTypes

Reputation: 1699

Vimdiff - How to hide all same lines in both files and show only different ones

vimdiff file1 file2

besides differences shows also same lines from both files. Is it possible to hide them? How to do it?

Upvotes: 16

Views: 7750

Answers (3)

Gehendra Acharya
Gehendra Acharya

Reputation: 1

The solution suggested by Ingo Karkat worked perfectly in Linux. Thanks for sharing it. However, it's not working on Mac.

Upvotes: 0

vortex0220
vortex0220

Reputation: 11

It is still showing common lines if common line is going in sequence with different. one after another

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172788

As Vim is a text editor (not a specialized diff viewer), the full contents of both files are kept (so you can do edits and persist them). Vim usually just "hides" multiple identical lines by folding them away; they are still present, just not visible.

You can influence how many identical lines are kept around changes (default: 6 lines above and below) via the context value of the 'diffopt' option. So, to completely fold all identical lines:

:set diffopt+=context:0

Upvotes: 20

Related Questions