There are many answers like this which talk about reversing the search results in one vimbuffer.

But I am wondering if there is way to highlight matching lines only in vimdiff. Something like following: vimdiff --reverse file1 file2 and the outcome highlights matching lines and hides non-matching.

  • not out of the box. you can probably script something around diff_hlID() and fold away lines that have diff highlighting applied to it. Something like this: :windo :set foldminlines=0 fdm=manual diffopt-=filler|:g/^/if diff_hlID(line('.'),1)|:norm! zf|endif. However that will create single line folds even for consecutive lines, so there is room for improvements. – Christian Brabandt Jul 9 at 6:38

Your Answer

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

Browse other questions tagged or ask your own question.