vim has this functionality built in (with the correct command line flag).
vim -d <file1> <file2>
This opens each file in a view and highlights the differences.
Any code that is identical is
folded away so you do not need to look at identical code or scroll through huge chunks of identical code.
But there is also a wrapper application
vimdiff that correctly invokes vim with the correct flags.
vimdiff source1.cpp source2.cpp
If you are using git you can set up an external diff tool. So it is easy to set up vimdiff to be the diff tool for git.
git config --global diff.tool vimdiff
When using vimdiff you can edit either side and diff highlighting keeps pace to show you the differences.
Note: When editing from a git diff. If you try and edit the repository stored version of the file your changes will be discarded when you exit (git does not trust you with the original so you are diffing against a tmp copy) but you can edit the local copy to your hearts content and save it over you current version.
Some basic commands that are useful in
dp diffput: puts changes under the cursor into the other file
making them identical (thus removing the diff).
do diffget: (o => obtain). The change under the cursor is replaced
by the content of the other file making them identical.
]c Jump to the next diff
[c Jump to the previous diff
Other vim settings I use to work with highliting with vimdiff
highlight! link DiffText MatchParen
This turns off highlighting on the bits of code that are changed. So the line that is changed is highlighted so I can spot the changes, but the actual text that has changed stands out on the line (as it is not highlighted).