2

I have 2 tables which I need to compare and display the differences. I am able to do that using the following command:

vim -d table1 table2 -c :TOhtml -c :wqa

The problem I am facing is it's excluding the headers and captions when doing the vimdiff. Can someone show me a way how to display the headers and captions/titles of the columns together with the differences?

I am looking for something like:

S.No Name Zipcode       S.No Name Zipcode
11   abc  75000         11   aabc 75000
12   def  85000         13   def  85000
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Sandosh Kumar P
  • 347
  • 1
  • 5
  • 14
  • try (echo "S.No Name Zipcode S.No Name Zipcode" &&vim -d table1 table2 -c :TOhtml -c :wqa) ? At least it looks like it has headers. – FrontENG Mar 08 '17 at 05:10

1 Answers1

1

you can create the following function, in your .bashrc or the command line:

mydiff () { 
vimdiff $1 $2    +'1sp
                   se noscb
                   winc l
                   1sp
                   se noscb
                   winc h
                   winc j'
}

Explanation :

  • 1sp : creates a split
  • se noscb : set noscrollbind for the newly created window
  • winc l : go the window on the right
  • 1sp : do a screen split
  • se noscb : set noscrollbind for the newly created window
  • winc h and winc j : go back to the first window

then just call the function as follows:

mydiff table1 table2
Charles
  • 11
  • 3