Answers:
并非完全符合您的要求,但可能会发现它有用:Splice插件:Vim插件,用于解决三路合并期间的冲突。它在Vimeo上有一个不错的演示截屏。
如果您要使用默认的vimdiff,则可以创建一个函数来检索环绕窗口的缓冲区编号,并使用它们调用:diffget
两次:
*:diffg* *:diffget*
:[range]diffg[et] [bufspec]
Modify the current buffer to undo difference with another
buffer. If [bufspec] is given, that buffer is used. If
[bufspec] refers to the current buffer then nothing happens.
Otherwise this only works if there is one other buffer in diff
(...)
The [bufspec] argument above can be a buffer number, a pattern for a buffer
name or a part of a buffer name. Examples:
:diffget Use the other buffer which is in diff mode
:diffget 3 Use buffer 3
:diffget v2 Use the buffer which matches "v2" and is in
diff mode (e.g., "file.c.v2")
您可以让他们使用映射将对此函数的调用分配给您所使用的键kdiff3
。
您可以在此vimcast上找到更多信息。
您可以只删除带有Git冲突标记的行。以下两种方法将删除所有以以下内容开头的行:
<<<<<<<
=======
>>>>>>>
方法1: 手动输入和执行命令
:g/^<\{7}\|^|\{7}\|^=\{7}\|^>\{7}/d
方法2: 实现用户定义的命令
"Delete all Git conflict markers
"Creates the command :GremoveConflictMarkers
function! RemoveConflictMarkers() range
echom a:firstline.'-'.a:lastline
execute a:firstline.','.a:lastline . ' g/^<\{7}\|^|\{7}\|^=\{7}\|^>\{7}/d'
endfunction
"-range=% default is whole file
command! -range=% GremoveConflictMarkers <line1>,<line2>call RemoveConflictMarkers()
Vim diffget和diffput将只选择一个分支或另一个分支。因此,除了上面给出的解决方案之外,唯一真正的解决方案是手动拉动两个文件并将其粘贴到工作副本中。