compare files and edit simultaneously with vimdiff

November 24th, 2006 mysurface Posted in Developer, vi, vim, vimdiff | Hits: 77453 | 14 Comments »

Refers to How to create patch file using patch and diff, you can actually read the diff file to compare the difference between the files. But what if you wanna compare and edit simultaneously?

Given 2 different files at your hand, you can do that with vimdiff. Let say I wanna compare this two files Tb01/TbApi.cpp and Tb02/TbApi.cpp, I can do this

 vimdiff Tb01/TbApi.cpp Tb02/TbApi.cpp

It nicely put two codes in a split windows, one at left and another at right. And it shows clearly the differences of them with highlights and line spacing. You really have to try it yourself to see how efficient it is.

By shifting from one windows to another, by pressing ctrl + w and press right arrow to move from left to right.

After finish editing,

:xa

To close both files and simultaneously write the changes, or

:qa!

which close both files without save.

14 Responses to “compare files and edit simultaneously with vimdiff”

  1. Use ctrl+ww to switch to next region, I find it more easy than ctrl+w arrow key.

  2. It’s useful for me! Thanks a lot!

  3. It seems like something is missing, no?

  4. Hello i am kavin, its my first occasion to commenting anywhere,
    when i read this article i thought i could also create comment due to this
    good paragraph.

  5. Pretty! This has been an extremely wonderful post.
    Many thanks for supplying this information.

    Feel free to surf to my web blog netin parhaimat ja parhaat kolikkopelit ovat kassa

  6. Hello! I ?ould have sworn I’ve been to thi? blog before but after ?eading through som? of the post I realized it’s new to me.
    ?nyw?ys, I’m definitely happy I found it and I’ll be book-marking and checking bac? frequently!

    Here is m? blog post :: megapolis warlord hack

  7. The other day, while I was at work, my cousin stole
    my iphone aand tested tto see if it can survive a 25 foot drop,
    just so she cann be a yolutube sensation. My iPad is now broken and she
    has 83 views. I know thhis is completely off topic but I had to share it
    with someone!

    my web site – download ios 8 beta

  8. I’m no longer positive where you’re getting your info, however good
    topic. I must spend a while studying more or understanding more.
    Thank you for magnificent information I used to be on the lookout for this information for my mission.

  9. I like the helpful info you provide in your articles.
    I will bookmark your blog and check again here
    regularly. I’m quite certain I willl learn mzny new
    stuff right here! Best of luck for the next!

    My blog; ios 8 beta iphone – Edith -

  10. Would it, using only steam and water, clean my tile floors.

    Many stores will have sales on other items throughout the weekend.

    It also has a lot of neat features, some that no other steam mop offers.

  11. I got this site from my buddy who informed me regarding this website and now this time I
    am visiting this web page and reading very informative
    content here.

  12. Sa?ed as ? favorite, I like your blog!

    my webpage: goodgame empire ha?k (http://www.youtube.com)

  13. hello!,I love your writing so so much! share we keep up a correspondence
    more about your article on AOL? I require a specialist on this space to unravel my problem.
    May be that’s you! Having a look ahead to peer you.

  14. If you desire to increase your familiarity only keep visiting this web page
    and be updated with the newest news update posted
    here.

    Look into my blog … svensk spilleautomater (romadayuse.com.braginclub.org)

Leave a Reply