Skip to main content
Author:

Ken Kundert

Version:
2.6.0
Released:

2021-08-25

Opens two files in vimdiff and provides single-stroke key mappings to make moving differences between two files efficient. Up to two additional files may be opened at the same time, but these are generally used for reference purposes.

Usage

vdiff [options] <file1> <file2> [<file3> [<file4>]]

Options

-v, --vim

Use vim (rather than default).

-g, --gvim

Use gvim (rather than default).

-f, --force

Edit the files even if they are the same.

-q, --quiet

Issue only error messages.

-h, --help

Print this helpful message.

Relevant Key Mappings

Ctrl-j

Move down to next difference

Ctrl-k

Move up to previous difference

Ctrl-o

Obtain difference

Ctrl-p

Push difference

{

Update file1 to match file2

}

Update file2 to match file1

S

Save any changes in all files and quit

Q

Quit without saving any file

=

Make all panes the same size and rotate between them

+

Update differences

When comparing 3 or 4 files, you must prepend the buffer number to the push or obtain command. The buffers are numbered from the left to the right starting with 1. For example, to obtain the difference from buffer 3, move to that difference and type ‘3 Ctrl-o’.

Defaults

Defaults will be read from ~/.config/vdiff/config if it exists. This is a Python file that is evaluated to determine the value of three variables: vimdiff, gvimdiff, and gui. The first two are the strings used to invoke vimdiff and gvimdiff. The third is a boolean that indicates which should be the default. If gui is true, gvimdiff is used by default, otherwise vimdiff is the default. An example file might contain:

vimdiff = 'gvimdiff -v'
gvimdiff = 'gvimdiff -f'
gui = True

These values also happen to be the default defaults.

As a Package

You can also use vdiff in your own Python programs. To do so, you would do something like the following:

from inform import display, Error
from vdiff import Vdiff

with Vdiff(l_filename, r_filename) as vdiff:
    try:
        if vdiff.differ():
            vdiff.edit()
        else:
            display('%s and %s are the same.' % (l_filename, r_filename))
    except KeyboardInterrupt:
        pass
    except Error as err:
        err.report()

You can also use vdiff to compare string:

from inform import display, Error
from vdiff import Vdiff

with Vdiff(l_identifier, r_identifier) as vdiff:
    try:
        if vdiff.differ():
            vdiff.compare_strings(l_string, r_string):
        else:
            display('%s and %s are the same.' % (l_identifier, r_identifier))
    except Error as err:
        err.report()

Using Vdiff with Mercurial

To use Vdiff with Mercurial , merge the following entries into your ~/.hgrc file:

[ui]
merge = vdiff

[extensions]
extdiff =

[extdiff]
cmd.vdiff = vdiff
opts.vimdiff = -g

These will result in Vdiff being used whenever a merge conflict occurs. It also allows you to use ‘hg vdiff’ to view differences between versions.

Using Vdiff with Git

To use Vdiff with Git , merge the following entries into your ~/.gitconfig file:

[merge]
    tool = vdiff
[mergetool "vdiff"]
    cmd = vdiff_executable $LOCAL $REMOTE

These will result in Vdiff being used whenever a merge conflict occurs.

Using Vdiff with Emborg

To use Vdiff with Emborg , merge the following entries into your ~/.config/emborg/settings file:

manage_diffs_cmd = "vdiff -g"

This results in Vdiff being used for interactive compare operations.

Installation

Runs only on Unix systems. Requires Python 3.6 or later. Install by running ‘./install’ or ‘pip3 install vdiff’.

Metadata

Release files for vdiff 2.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vdiff 2.6.0
File Size Uploaded
vdiff-2.6.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vdiff 2.6.0
File Interpreter ABI Platform
vdiff-2.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / vdiff-2.6.0.tar.gz

Download URL vdiff-2.6.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
111a17bf8079603fd2158c52ddf91eb6116a9eaaa648b27a42c70fbb2cefdd49
BLAKE2b-256 checksum
How to use checksums
0a3a4380f37bf0757660d60f1c0e9a0df041e4a738aabe8a105154f94f6b4942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

Release files / vdiff-2.6.0-py3-none-any.whl

Download URL vdiff-2.6.0-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e22ffe2575cc6a430568cc4128eabb31ddbb004a3d2ada3cdd7b6f043bbb5c1
BLAKE2b-256 checksum
How to use checksums
774888b1530e515270bf90fff7c4aadbc80ac57cffface0fd4ff521b1d1056bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

2.6.0 This release

2 release files

2.5.0

1 release file

2.4.0

1 release file

2.3.6

1 release file

2.3.5

1 release file

2.3.4

1 release file

2.3.3

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.0

1 release file

2.1.5

1 release file

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page