Ⅰ. 插件描述
Motions to and inside SCM conflict markers.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/conflictmotions'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/conflictmotions'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/conflictmotions'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ConflictMotions
Ⅳ. 文档说明
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.