vimdiff / vim -d -- how to show only the differences and fold all identical lines?
11,926
You can do this once off by setting options on the vimdiff
command:
vimdiff -c 'set diffopt=filler,context:0' file1 file2
Alternatively, add to your .vimrc
:
set diffopt=filler,context:0
Or, once in vimdiff
, set this temporarily with
:set diffopt=filler,context:0
This will tell vimdiff
(or if you prefer, vim -d
) to not provide the full context for the lines in which differences were found. Consecutive lines with no changes will be "folded".
Related videos on Youtube
Author by
Sandosh Kumar P
Updated on September 18, 2022Comments
-
Sandosh Kumar P over 1 year
Is there a way we can exclude the lines which are same in the below output? I did a vim -d file1 file2 but its showing the differences and also some additions lines before and after the differences. How to exclude that?
In the attached example 131, 132, 134, 136 etc are same in both the files but its still getting displayed.