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
1
  • 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 8, 2017 at 5:10

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .