Use vimdiff to replace entire file?

mazlix picture mazlix · Jun 6, 2011 · Viewed 10.9k times · Source

I'm using vimdiff for a git merge. Is there a quick way to select 1 file to use, right now i'm just selecting everything from one buffer, replacing the $MERGE with that, and then saving. I guess I can macro that, but was wondering if there is a better way. Thanks!

Answer

sehe picture sehe · Jun 7, 2011

Several ways:

:%diffput

to do 'put' all changes from the current buffer to the 'other' buffer. This makes it easy with three-way diffs:

:%diffput OURS

The 'OURS' pattern will match uniquely on buffernames participating in the current diff

All the above can be done in reverse, substituting do or :diffget