当使用vimdiff

时间:2016-10-19 06:17:14

标签: vim vimdiff vim-fugitive

比较文件时,我喜欢使用vimdiff(或vim -d),我知道推荐使用vimdiff复制更改的方法是:

]c               - advance to the next block with differences
[c               - reverse search for the previous block with differences
do (diff obtain) - bring changes from the other file to the current file
dp (diff put)    - send changes from the current file to the other file

我也知道

  • :diffgetdo

  • 相同
  • :diffputdp

  • 相同

所有这些命令都能完美运行(包括:diffput),但是当我输入dp时,没有任何变化,并且会产生错误声音。

我认为这是因为与vim-fugitive的热键映射冲突,其中有一个热键dp

dp    :Git! diff (p for patch; use :Gw to apply)
dp    :Git add --intent-to-add (untracked files)

如何解决这个问题?谢谢。

2 个答案:

答案 0 :(得分:1)

您仍然可以通过:normal! dp调用内置映射。

如果您需要多次,最好取消定义原始缓冲区本地映射:

:nunmap <buffer> dp

但是,正如@Kent所评论的那样,逃犯dp映射仅在预览窗口(cp。:h fugitive-:Gstatus)中有效。由于您应该使用普通窗口进行差异和合并,因此不应该重叠。

答案 1 :(得分:0)

我遇到了同样的问题。我的错误是map p映射p也处于运营商挂起模式。您可以尝试ounmap p。就我而言,它与miniyank plugin

有关
相关问题