Vim Tips Wiki

Use this page to discuss script 3991 ConflictMotions: motions to and inside SCM conflict markers

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.

Former Bug: Taking conflicts with hunk at end of file[]

When a conflict in a file extends to the very end of the file (i.e. the last line is part of the conflicting hunk), I can't use the keys to take a specific hunk and delete the rest. Attempting to do so throws an error:

Error detected while processing function ConflictMotions#Take..ConflictMotions#TakeFromConflict..ingo#lines#PutWrapper:
line   30:
E16: Invalid range: 2put! =a:lines

Oddly, this doesn't occur if the conflict spans the whole file. But as long as it starts on at least line 2 or later, and goes to the end, any attempt to take a particular hunk fails (and deletes the entire conflict). Deleting the entire conflict with <Leader>xd still works fine.

Here's a sample file:

Some text above the conflict. Bug doesn't happen if it covers the whole file.
<<<<<<< HEAD
Some text here for HEAD
||||||| ANCESTOR
Some text here for ANCESTOR
======= OLD
Some text here for OLD. There must not be a line after the close marker.

This was reproduced with version 2.00.

Kballard (talk) 01:45, May 17, 2014 (UTC)

This can be fixed by editing autoload/ConflictMotions.vim line 281 and changing

call ingo#lines#PutWrapper(a:startLnum, 'put!', l:sections)


call ingo#lines#PutBefore(a:startLnum, l:sections)

Kballard (talk) 02:00, May 17, 2014 (UTC)

Former Bug: Taking conflicts where hunk spans entire file adds blank line[]

When the conflict spans the entire file, taking a hunk leaves an extra blank line at the end.

The reproduction is similar to above, but without that first line:

 1 <<<<<<< HEAD
 2 Some text here for HEAD
 3 ||||||| ANCESTOR
 4 Some text here for ANCESTOR
 5 ======= OLD
 6 Some text here for OLD. There must not be a line after the close marker.
 7 >>>>>>>

Taking any hunk will work, but it will leave a blank line afterwards:

 1 Some text here for HEAD

Kballard (talk) 02:05, May 17, 2014 (UTC)

Former Bug: Taking an empty hunk beeps[]

When a hunk is empty, trying to take it beeps. This apparently is caused by executing the command normal yi=. Which is to say, the inner section mapping beeps if there's no content. That seems reasonable, but I would not expect :ConflictTake this to beep when the section is empty, as it is actually doing work (it's deleting the other sections).

Unfortunately, it appears the beep is produced by CountJump and there is no way to suppress it. I believe the only solution is to temporarily :set vb t_vb=.

Kballard (talk) 02:32, May 17, 2014 (UTC)

Thanks for reporting those. You're lucky that I saw them here; I don't get automatically notified of comments to my plugins here. In the future, please just send an email to the address found in the plugin help. I've addressed all three bugs in version 2.01. -- Inkarkat (talk) 19:08, May 31, 2014 (UTC)
I put a note at Vim Tips Wiki:Script comment guidelines#Script authors showing how you can be notified whenever this page is edited, if you want. That link is available at "(see the guideline)" near the top of this page. JohnBeckett (talk) 05:15, June 2, 2014 (UTC)