When viewing a diff of two files in Vim, you can put changes from the source file to the destination file by pressing d then p, or by running :diffput
. However, this doesn't work if the change is a deleted line.
For example, let's look at the contents of the file one.txt
:
a
b
c
And the contents of the file two.txt
:
a
c
If I open the two files in diff mode (vimdiff one.txt two.txt
), and I have my cursor on the file two.txt
, how do I push the change (that is, the deleted line) from two.txt
to one.txt
? The only way to do it seems to be to change the focus to the other window one.txt
and then run do, but that is a lot of keystrokes, especially if you have multiple windows open.