Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy-paste lines between tabs in vimdiff

I'm using vimdiff to see the difference between two files. I'm wondering if it is possible to copy a line from the left tab (the first file) and paste it in the second tab (the second file). Actually, I can't even seem to be able to access the second tab.

Thank you!

like image 754
nay Avatar asked Apr 16 '12 17:04

nay


People also ask

How do I copy a line in Vimdiff?

Use dp for copying the current difference block to another side, do for copying from another side to the current. dp means "put", do means "obtain". The current difference block is where your caret is.

How do I move between windows in Vimdiff?

Ctrl+w and right and left arrow can be used to move between any split windows on vim, not only vimdiff splits. These keys do work here on cygwin; also, Ctrl+w w also moves to the next window, but without the delay you mentioned.


1 Answers

As mentioned in comments, you can use dp or do to move the diff the cursor is on between the buffers.

You can also use the commands :[range]diffget and :[range]diffput, meaning if you've already reviewed all differences in the whole file, you can do :1,$diffput or :1,$diffget to move all diffs from or to, respectively, the current buffer.

like image 120
sanmiguel Avatar answered Oct 17 '22 07:10

sanmiguel