Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Motions to and inside SCM conflict markers.
VimL
branch: master

Version 2.10

- ENH: Define both normal and visual mode mappings for all mappings, not the exclusive either-or. The new visual mode mappings will select the corresponding section in all conflicts found in the selected range. (Application on a partially selected conflict is denied by an error since version 2.02.)
- ENH: Enable repeat of all mappings, also (with visualrepeat.vim) across modes. Thanks to Maxim Gonchar for the suggestion.
- Handle folded ranges overlapping the conflicts. Thanks to Maxim Gonchar for reporting this. When querying which conflict sections to keep, open folds so that if possible the entire conflict is visible, but at least the section markers.
- Re-allow combining range inside conflict with section argument, but only for the :ConflictTake command, not the mappings.
latest commit 6bff6773ba
Ingo Karkat authored committed
Failed to load latest commit information.
autoload Version 2.10
doc Version 2.10
plugin Version 2.10
README Version 2.10

README

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3991

DESCRIPTION
This plugin defines movement commands and text objects to go to and operate on
conflicting lines, as indicated by many revision control systems, like
Subversion, Git, etc. The source code management system inserts conflict
markers such as <<<<<<<, =======, and >>>>>>> on merges to indicate that the
automatic resolution failed; this plugin helps you with locating and resolving
these conflicts.

RELATED WORKS
To be alerted to the existence of conflict markers and to visually
differentiate the conflicted lines, you can use the highlighting, warnings and
custom buffer status provided by the companion ConflictDetection.vim plugin
(vimscript #4129).

USAGE
]x                      Go to [count] next start of a conflict.
]X                      Go to [count] next end of a conflict.
[x                      Go to [count] previous start of a conflict.
[X                      Go to [count] previous end of a conflict.

]=                      Go to [count] next conflict marker.
[=                      Go to [count] previous conflict marker.
                        Mnemonic: = is in the separator between our and their
                        changes.

ax                      "a conflict" text object, select [count] conflicts,
                        including the conflict markers.

a=                      "a conflict section" text object, select [count]
                        sections (i.e. either ours, theirs, or base) including
                        the conflict marker above, and in the case of "theirs"
                        changes, also the ending conflict marker below.

i=                      "inner conflict section" text object, select current
                        section (i.e. either ours, theirs, or base) without
                        the surrounding conflict markers.

:ConflictTake           From the conflict the cursor is in, remove the markers
                        and keep the section the cursor is inside.
:ConflictTake [none this ours base theirs both all query] [...]
:ConflictTake [-.<|>+*?][...]
                        From the conflict the cursor is in, remove the markers
                        and keep the passed section(s) (in the order they are
                        specified).
                            none, - = delete the entire conflict
                            both    = ours theirs               (+ = <>)
                            all     = ours [base] theirs        (* = <|>)
                            query   = ask which sections to take
                        Note: | must be escaped as \|.
:[range]ConflictTake [none this ours base theirs both all range query] [...]
:[range]ConflictTake [-.<|>+*:?][...]
                        When the cursor is inside a conflict, and the [range]
                        covers part of that conflict:
                        From the conflict the cursor is in, remove the markers
                        and keep the passed range (without contained markers)
                        (and any passed sections in addition; include the
                        "range" / ":" argument to put the range somewhere
                        other than the end).
                        Otherwise, when a large range (like %) is passed:
                        For each conflict that starts in [range], remove the
                        markers and keep the passed section(s) / ask which
                        section(s) should be kept. You can answer the question
                        with either the symbol or the choice's starting
                        letter. An uppercase letter will apply the choice to
                        all following conflicts.

<Leader>xd              Delete the entire current conflict / all conflicts in
                        the selection.
<Leader>x<              Keep our changes, delete the rest.
<Leader>x|              Keep the change base, delete the rest.
<Leader>x>              Keep their changes, delete the rest.

<Leader>x.              Keep the current conflict section, delete the rest.
{Visual}<Leader>x.      From the conflict the cursor is in, remove the markers
                        and keep the selected lines (without contained markers).
                        For each conflict that starts in the selection, remove
                        the markers and ask which section(s) should be kept.
Something went wrong with that request. Please try again.