views:

686

answers:

5

scmdiff marks the differences between the checked in version of a file and the file that's being edited. It marks it by coloring the changed lines. Is there any way to view the changes using a vimdiff-style split instead of just coloring the changed lines?

For instance, if abc is a file under version control, then I can use the following to display the current version of abc on one side and the latest version on the other side:

tkdiff abc

I can also do:

tkdiff -r1 -r5 abc

to show the differences between versions 1 and 5. Finally, I can do:

tkdiff -r1 abc

to see the difference between the current version and version 1.

This is the sort of diff I'd like to see between two versions of a file, only using VIM. Can it be done?

Edit: I neglected to mention my OS and version control system. I'm working under Linux and I use Bitkeeper for version control.

+3  A: 

I use vimdiff with subversion the following way:

When I want to see differences in vimdiff for a specific file or a group of files I do:

svn diff [files] --diff-cmd svd

Here the --diff-cmd instructs subversion to use the command "svd" instead of its default diff behavior. svd is the following shell script:

#!/bin/bash
shift 5; /usr/bin/vimdiff -f "$@"

You did not mention your OS, the above will work for Linux and OS X for sure.

KIV
+1  A: 

I'm a happy user of bazaar's vimdiff plugin. For git, there's gitvimdiff (and several other solution can be used). Mercurial can do this as well.

Zsolt Botykai
A: 

For ClearCase VCS there exists a plug-in which also does what you want.

Canopus
+4  A: 

I use the vcscommand plugin for interacting with a VCS.

From the description:

VIM 7 plugin useful for manipulating files controlled by CVS, SVN, SVK and git within VIM, including committing changes and performing diffs using the vimdiff system.

+2  A: 

VCSCommand plugin is really helpful in this case and it woks seamlessly with SVN,CVS and other repositories also.

:VCSVimDiff     //applies vimdiff between the file loaded in buffer and the copy in repository.

Naga Kiran