Vimdiff vs source repo control

scmdiff notes the differences between the verified version of the file and the file that is being edited. He notes this by coloring modified lines. Is there a way to view the changes using a vimdiff shaped split instead of just coloring the changed lines?

For example, if abc is a versioned file, I can use the following information to display the current version of abc on the one hand and the latest version on the other:

 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 type of diff that I would like to see between two versions of a file, only using Vim. It can be done? I work under Linux and I use Bitkeeper for version control.

+4
source share
5 answers

I use vcscommand to interact with VCS.

From the description:

VIM 7 plugin useful for managing files managed by CVS, SVN, SVK and git inside VIM, including making changes and making differences using the vimdiff system.

In particular :VCSVimDiff will split the current window and show "vimdiff" against the latest version in the repo. You can also specify one version number to compare the current buffer with (for example :VCSVimDiff -2 ) or two revision numbers to distinguish each other. Here is the relevant section from the docs:

: VCSVimDiff

Uses vimdiff to display differences between versions of the current file.

If no revision is specified, the most recent version of the file does not use the current branch. With one argument, this argument is used as a revision, as indicated above. With two arguments, the differences between the two revisions are displayed using vimdiff.

When using zero or one argument, the source buffer is used to execute wimdiff. When the zero buffer is closed, the original buffer will be returned to normal mode.

Once vimdiff mode is started using the above methods, additional vimdiff buffers can be added by passing a single version argument to the command. There can be up to 4 vimdiff buffers in total.

Using the 2 argument form of the command resets vimdiff with only those 2 versions. Also, calling the command in another file will close the previous vimdiff buffers.

+8
source

I am using vimdiff with subversion as follows:

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

 svn diff [files] --diff-cmd svd 

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

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

You have not mentioned your OS, this will certainly work for Linux and OS X.

+8
source

The VCSCommand plugin is really useful in this case, and it is easily implemented with SVN, CVS, and other repositories. :VCSVimDiff applies vimdiff between a file loaded into the buffer and a copy in the repository.

+2
source

I am a happy bazaar vimdiff plugin user. For git, gitvimdiff (and a slightly different solution ). Mercurial can also do this .

+1
source

There is a plugin for ClearCase VCS that also does what you want.

0
source

All Articles