IMEDIFF(1)

NAME
imediff - An interactive fullscreen merge tool for 2 or 3 files

SYNOPSIS

imediff [-a] [-b] [-d] [-f] [-h] [-m] [-n] [-t] [-l N] [-o file_out] {file_older} {file_newer}

imediff [-a] [-b] [-c] [-d] [-f] [-g] [-h] [-m] [-n] [-t] [-l N] [-o file_out] {file_yours} {file_base} {file_theirs}

DESCRIPTION

Merge two (slightly different) files with an optional common base file interactively with a user friendly fullscreen interface in the full screen text terminal mode.

imediff shows the differences of given two files (in color if the terminal supports them), lets you scroll the file and toggle changes between older and newer version for each chunk of difference. You can also select line diff and character wdiff mode for display. If you wish to make manual changes, you can edit each chunk with editor. The result of merge operation is saved in file_out.

Additionally, you can customize your choice of editor via $EDITOR or ~/.imediff. The default editor is /usr/bin/editor.

Removed lines are shown in reversed '???' as a placeholder, so you see that and you can select them. While it takes one line on display, it is naturally not saved into the output file.

To see the key binding, hit h in the main imediff screen.

To see the tutorial, hit H in the main imediff screen or simply start the imediff command without arguments.

The program exits with status 0 if the changes were saved, 1 if the merging was aborted and 2 if the parameters were invalid.

OPTIONS

-o file_output, --output=file_output
    Write output to a given file. If missing, STDERR is used.

-l N, --linerule=N
    Line alignment fuzzy matching rule. (Partial string matches are tried on the top of this pre-filtering)

        • N=0: Line alignment after stripping leading and tailing whitespaces

        • N=1: Line alignment after stripping all whitespaces

        • N=2: Line alignment after stripping all whitespaces and quotation marks (default)

        • N=3: Line alignment after stripping all non-alphanumerics

        • N=10: Line alignment after stripping leading and tailing whitespaces and lowecasing

        • N=11: Line alignment after stripping all whitespaces and lowecasing

        • N=12: Line alignment after stripping all whitespaces and quotation marks and lowecasing

        • N=13: Line alignment after stripping all non-alphanumerics and lowecasing

-m, --mode
    Display mode column.

--mono
    Force monochrome display.

--sloppy
    Allow one to save unresolved contents.

-n, --non-interactive
    Non-interactive mode.

--macro=MACRO
    Pre-load MACRO to keyboard input. MACRO key binding is the same as the normal keyboard input and can be remapped by the configuration file. The only exception is ':' which means end MACRO input and process keyboard input interactively.

-a
    Start with version A (={file_older} or {file_yours}).

-b
    Start with version B (={file_newer} or {file_base}).

-c
    Start with version C (={file_theirs}) for 3 files.

-d
    Start with diff by line between version A and version B for 2 files. (default for 2 files)

    Start with diff by line between version A and version C while using version B as base version for 3 files.

-f
    Start with wdiff by character between version A and version B for 2 files.

    Start with wdiff by character between version A and version C while using version B as base version for 3 files.

-g
    This is the default starting mode for 3 files. For the cleanly merged resolved portion, display wdiff by character between version A and version C while using version B as base version. For the unresolved portion, display diff by line, instead.

-h, --help
    Show summary of options and exit.

-t, --template
    Create (or overwrite) ~/.imediff with default values.

-V, --version
    Show version and exit.

KEYBOARD COMMANDS

The following keyboard commands are available in the editor as default.

w, x
    Write and eXit if merge is resolved. (default behavior)

    Write and eXit unconditionally. (when --sloppy specified)

q, ctrl+c
    Exit without saving.

home, t, end, z
    Jump to start or end of chunks.

h
    Show commands.

shift+h
    Show tutorial.

s, ?
    Show the state of the merge.

down, j, up, k
    Move scope of the display for 1 line.

left, right
    Move scope of the display for 1 column.

page up, page down
    Move scope of the display for screenfull lines.

enter
    Toggle mode of display for a selected chunk.

n, space
    Jump to next changed chunk.

N, tab
    Jump to next unresolved chunk (mode "d" or "f").

p, backspace
    Jump to previous changed chunk.

P, back-tab
    Jump to previous unresolved chunk (mode "d" or "f").

a
    Set mode of the current chunk to "a" to display version A.

b
    Set mode of the current chunk to "b" to display version B.

c
    Set mode of the current chunk to "c" to display version C for 3 files.

d
    Set mode of the current chunk to "d" to display diff by line.

e
    Set mode of the current chunk to "e" to display editor buffer if available.

f
    Set mode of the current chunk to "f" to display wdiff by character. If cleanly merged, mode is set to "g" instead.

g
    This causes automatic merge efforts on a chunk for 3 files in the following order.

    If the editor result buffer has content, mode is set to "e".

    If a chunk is resolved cleanly, mode is set to "a", "c", or "g". This overrides previous manual settings such as "a", "b", or "c".

    If a chunk isn't resolved cleanly, mode is left as mode "g" or "f".

shift+a
    Apply "a" to all chunks.

shift+b
    Apply "b" to all chunks.

shift+c
    Apply "c" to all chunks.

shift+d
    Apply "d" to all chunks.

shift+e
    Apply "e" to all chunks.

shift+f
    Apply "f" to all chunks.

shift+g
    Apply "g" to all chunks.

m
    Launch external editor on the current chunk, save its result to the editor buffer, and set its mode to "e".

shift+m
    Remove the editor buffer of the current chunk when its mode is "e".

FILE

The key choices of the above keyboard commands can be configured in ~/.imediff which is created at the first execution of this command. The left side is the keys described in this manpage. The right side is your configuration choices. The current settings can be confirmed by the 'h' key dialog.

SEE ALSO

sdiff (1), diff (1), merge (1), diff3 (1).

COPYRIGHT

This manual page as well as the program itself was written by Jarno Elonen <elonen@iki.fi> and Osamu Aoki <osamu@debian.org>. Unlike the program itself, which is licensed under the GNU General Public License (GPL) version 2 (or any later version, at your option), this document has been placed into the Public Domain.

AUTHORS

Jarno Elonen <elonen@iki.fi>
    Original author for 2 file merge in python2

Osamu Aoki <osamu@debian.org>
    Rewrite author for 2 and 3 file merge in python3

COPYRIGHT
Copyright © 2003-2006, 2018 Jarno Elonen <elonen@iki.fi>, Osamu Aoki <osamu@debian.org>