Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using diffget in vimdiff

Tags:

vim

vimdiff

I'm trying to learn to use vimdiff well. Currently I figured out how to get a block of diff from a buffer to another (using do) but what I'm willing to do now is to simply get one (or some) line of a block in the other buffer.

The vimdiff documentation says:

:[range]diffget

but I can't figure how to have a correct range parameter to simply copy the line I'm on from a buffer to the other.

like image 278
claf Avatar asked May 15 '09 12:05

claf


2 Answers

You can use

:.,.

as range from current line to the current line.

According to the doc you can omit range and then current line or line above will be used.

like image 58
Mykola Golubyev Avatar answered Sep 18 '22 14:09

Mykola Golubyev


I find it a bit easier to select the current line with V and then to do or dp. This has the same effect as selecting the rage with :.,. but it is easier to type! Also, you can easily add adjacent lines with j or k.

like image 25
dotancohen Avatar answered Sep 18 '22 14:09

dotancohen