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.

enter image description here

1 Answer 1


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.