How to move diffs of vimdiff output to top of results

file1 contains:
AAA
BBB
CCC
DDD
EEE

file2 contains:
AAA
BBB
CCC
TTT
DDD
EEE

Command:
vimdiff -c "set diffopt+=iwhite" -c "set diffopt=filler,context:1000000" -c "set nowrap" "file1" "file2" -c TOhtml -c 'w! diff.html' -c 'qa!' < /dev/null 2> /dev/null

it generate a html page with marked differences in the middle .
i am looking for a solution where i can show the differences in html output to top .
note :slight_smile: By default both file1 and file2 is sorted in my script .

@voldemort , Welcome. Please ,make use of the MARKDOWN menu options to properly format your text/prose/code (it takes 5mins) - read the forum's FAQs/guidelines.

if i understand your request -
presume you get output something along the following (ignoring formatting, simply demonstrating the order)

AAA								AAA
BBB								BBB
CCC								CCC
						      >	TTT
DDD								DDD
EEE								EEE

but you'd like to see it in the following order ?

						      >	TTT
AAA								AAA
BBB								BBB
CCC								CCC
DDD								DDD
EEE								EEE

is that assumption correct ?

Exactly ,
i wanted to show the difference on top .
Thank you for the suggestion .

on the sample provided i ran

(though, how that might work for more elaborate examples .... you'd need to attempt)

sdiff file1 file2 | sort
							>	TTT
AAA								AAA
BBB								BBB
CCC								CCC
DDD								DDD
EEE								EEE

Since we are generating a nice looked with highlights using vimdiff , is there any possibilities of getting similar design using sdiff or can be possible same results using vimdiff or using sed on diff.html file iself for moving the diffs lines shifting to top ?

Can you use diff2html?

i have found other solutions by text line shifting in o.p diff.html file itself.

1 Like

@voldemort , that's good news. Please share this solution with the forum - everyone benefits and you have some kudos knowing that you've given back to the wider community.

thks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.