0

With all the advanced editing capabilities of Vim, I find it hard to believe that VimDiff doesn't have a way of copying from/to right/left!! What else can a difftool be used for? Any idea? What are the capabilities of VimDiff?

Also, I don't even see a way of moving to the next/prev difference!!

Rafid
  • 18,991
  • 23
  • 72
  • 108
  • 1
    The question "What are the capabilities of VimDiff?" logically *precedes* the question "Why is VimDiff so limited?" :) In any case, the only thing I really miss is the ability manually align diff regions when it gets confused. – Mud Dec 25 '10 at 21:10
  • Nice comment :-) Yeah, I admit I was too rude thinking that VimDiff doesn't support simple capabilities :D – Rafid Dec 26 '10 at 10:56
  • But what do you mean by manually aligning diff regions? How would you control thta? And what difftool supports that? – Rafid Dec 26 '10 at 10:57
  • 3
    By "manual aligning" I mean manually telling the diff engine that *this* line in file A corresponds to *that* line in file B. [BeyondCompare](http://www.scootersoftware.com/) supports it, and it's sometimes invaluable. Or to put it another way, when you need it and it's *not* there (which happens to me sometimes in Vim) it's maddening. – Mud Dec 26 '10 at 11:38
  • Oh, that would be great. I always thought of such a feature. – Rafid Dec 26 '10 at 14:37
  • Definitely consider consulting `:help` before posting to SO. – Will Nov 20 '12 at 08:37

2 Answers2

23

Every thing is explained in the help ... (do, dp, ]c, [c)

:h diff

:h :h is also your friend.

Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
9

You need to use do and dp for your copying needs; these represent 'put' from current window, and 'obtain' from the other window. (This assumes a dual-split diff.)

For moving to next/prev difference, use ]c and [c .

Here are the basic commands I use, with mnemonics where possible:

dp - 'put' the changes from the current window into the other window.
do - 'obtain' the changes from other window.
]c - Go to change after (ending/next bracket) -- move to the next difference.
[c - Go to change before(opening/previous bracket) -- move to the previous diff.
zo - 'open' a section of folded text.
zc - 'close' a foldable text section.
Ctrl-W+Ctrl W - (That's ^W twice.) Jump to the other window.
:diffupdate - updates diff based on changes .
belacqua
  • 543
  • 4
  • 18