Jump to next merge conflict


If you’re using source control like Git, SVN, or Mercurial then you’re probably accustomed to resolving merge conflicts. There are a variety of tools available to you in Vim to make merge conflict resolution easier.

The tool that has become most essential to my workflow is a set of mappings provided by the Unimpaired plugin to jump to the next conflict marker:

  • ]n goes to the next conflict marker
  • [n goes back to the previous conflict marker

You can also use these with d to delete until the next marker or delete back to the previous marker. This makes quick work of picking which half of the conflict you wish to keep.

  • d]n delete till the next conflict marker
  • d[n delete back to the previous conflict marker

Here’s a short demo of these mappings in action. If you have large files or a lot of conflicts, use ]n to rip through them quickly.

How useful was this tip?

Average rating 3.7 / 5. Vote count: 679

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

105 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts