SVN diff uses Vimdiff as the diff comparison tool

Source: Internet
Author: User
Tags diff svn

SVN diff uses Vimdiff as an article description of the comparison diff tool reference

One of the Vim's nice features are a powerful diff tool that can being used to easily tell the differences between multiple differ ent files. This can is called up at any time by issuing the following:


Subversion ' s default diff Tool-while effective-lacks a lot of options. Firstly, it simply outputs the results of the diff to standard out. This was limiting for several reasons:you can ' t edit the files of you ' re diffing, so quickly changing code is impossible. There ' s also no color or syntax highlighting, so telling at a glance what ' s changed are more difficult. Vimdiff solves all these problems, as it drops your into a full instance of vim allowing your to do anything.
Why Use SVN diff when we can seamlessly integrate Vimdiff to the workflow in and simple steps? Let ' s get started!

Step 1:the Script

The first thing that needs to being done was to create a simple bash script that would be the the wrapper for SVN diff. Create the Following file on your system named

#!/bin/sh# Configure your favorite diff program here.DIFF="/usr/bin/vimdiff"# Subversion provides the paths we need as the sixth and seventh# parameters.LEFT=${6}RIGHT=${7}# Call the diff command$DIFF$LEFT$RIGHT

You can either put it in a System wide folder (/usr/local/bin) or in your own folder. In any event, don ' t forget to

chmod a+x

Step 2:make Subversion Use It

Now of the script exists, we have a to-tell Subversion to use it for diff. Luckily that's quite easy. Simply edit ~/.subversion/config and find the Diff-cmd line inside the [Helpers] section. Uncomment it and change it to something like this:

Diff-cmd =/path/to/

Step 3:profit!

You ' re all done! To see it in action, change directory into a Subversion project with some local changes, and simply diff like normal:

SVN diff

About the use of Vimdiff

vim-d a.txt B.txt
Vimdiff a.txt B.txt

shortcut Keys Description
[C Jump to Previous diff
]c Jumps to the next difference item
Zo Expand collapsed Same Code
Zc Re-fold
Dp To copy the difference from the current location to another file
Do Copy the difference of another file to the current file

Author @AdvocateOS_CoderD
February 12, 2015

SVN diff uses Vimdiff as the diff comparison tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.