1

When comparing files, I like to use vimdiff(or vim -d) and I know a recommended way of copying changes with vimdiff is:

]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

and I also know that

  • :diffget is the same as do

  • :diffput is the same as dp

All these commands work perfectly (including:diffput), but when I input dp, nothing changes and an error sound is produced.

I think this is because of a hotkey mapping conflict with vim-fugitive, which has a hotkey dp:

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

How to fix this problem? Thank you.

Jair López
  • 650
  • 1
  • 5
  • 16
jack guan
  • 331
  • 2
  • 12
  • fugitive's `dp` works in preview window, however diff's `dp` is for diff mode, do they have conflict? btw, your logo picture is exactly same as mine – Kent Oct 19 '16 at 08:44

2 Answers2

1

You can still invoke the built-in mapping via :normal! dp.

If you need this multiple times, better undefine the original buffer-local mapping:

:nunmap <buffer> dp

However, as @Kent has commented, fugitive's dp mapping is only active in a preview window (cp. :h fugitive-:Gstatus). Since you should use normal windows for diffing and merging, there shouldn't be an overlap.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • `:nunmap dp` can't not work: E31: No such mapping – jack guan Oct 25 '16 at 06:48
  • I feel sorry. Input `:nunmap dp`, then output: `E31: No such mapping'。 Actually, I can't find dp in `nmap`. I agree what you say about :" fugitive's dp mapping is only active in a preview window (cp. :h fugitive-:Gstatus). " What's more, when startup vim without .vimrc or pluggings -- `vim -u NONE -N`, `dp`command works perfectly. So, what could I do next step? – jack guan Oct 25 '16 at 07:05
  • I feel sorry. Input `:nunmap dp`, then output: `E31: No such mapping`。 Actually, I can't find dp in `nmap`. I agree what you say about :" fugitive's dp mapping is only active in a preview window (cp. :h fugitive-:Gstatus). " What's more, when startup vim without .vimrc or pluggings -- `vim -u NONE -N`, `dp`command works perfectly. – jack guan Oct 25 '16 at 07:06
  • You have to execute the `:nunmap dp` in the fugitive buffer that was opened via `:Gstatus` (so this shows a Git status, and has filetype GITCOMMIT), as the mapping is only defined there. If the command causes `E31: No such mapping`, then the built-in `dp` should work just fine, no problem there. – Ingo Karkat Oct 26 '16 at 07:13
  • Your conclusion is helpful. As causes `E31: No such mapping`, I think `dp` had been **unmap** by an unknow plugin, than **remap**. Therefor, I put this in .vimrc: `nnoremap dp :diffput`. It works well. How ever, I don't know which plugin should be blamed yet. – jack guan Nov 01 '16 at 07:47
0

I was having the same problem. My error was that map p maps p also in operator-pending mode. You can try to do a ounmap p. In my case, it was related to the miniyank plugin

José Luis
  • 3,713
  • 4
  • 33
  • 37