Merging with vimdiff

Open the files with vimdiff:
$ vimdiff file1 file2

To jump to the next difference:
]c

To jump to the previous difference:
[c

If there are only two files you can copy differences with:
:diffget
and
:diffput

If you are doing a diff with vim between more than two files you also have to specify from which buffer to :diffget or from which buffer to :diffput
:diffget b#
where b# is the buffer number. In vertical window split, buffers are numbered from left to right starting at 1.

Advertisements

4 Responses to Merging with vimdiff

  1. […] Merging with vimdiff Open the files with vimdiff: $ vimdiff file1 file2 […]

  2. JP says:

    thanks, just what I needed!

  3. gpvprasad says:

    Reblogged this on Gpvprasad's Blog.

  4. droope says:

    Quick note: You can diffput by typing dp and diffget by typing dg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: