compare files and edit simultaneously with vimdiff

November 24th, 2006 mysurface Posted in Developer, vi, vim, vimdiff | Hits: 114718 | 17 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,


To close both files and simultaneously write the changes, or


which close both files without save.

17 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 (

  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

    Look into my blog … svensk spilleautomater (

  15. I’m gone to convey my little brother, that he should also visit this blog on regular basis to obtain updated from most recent information.

  16. I am truly thankful to the owner of this website who has shared this fantastic paragraph at
    at this time.

    Feel free to surf to my homepage … brave frontier online
    hack (Margot)

  17. I actually have been exploring for a bit for almost any high quality articles or blog
    posts in this kind of house . Exploring in Yahoo I eventually found this website.
    Studying this info So i am just glad to express that I have a very just right uncanny feeling
    I discovered just what I needed. I this kind of lot beyond doubt will make sure to do not forget to
    remember this site and provide it a glance regularly.

    My page WinnieRScola

Leave a Reply