Two-way diff for Git merge conflicts. Shows OURS vs THEIRS side-by-side.
Based on vim-diffconflicts by Seth House.
{
"Yeshwanthyk/resolver.nvim",
}use "Yeshwanthyk/resolver.nvim"Plug 'Yeshwanthyk/resolver.nvim'# Auto-detect backend (JJ preferred)
nvim -c ResolvePick
# Force backend
nvim -c "ResolvePick jj"
nvim -c "ResolvePick git"| Command | Description |
|---|---|
:Resolve |
Open two-way diff for current file |
:ResolveClose |
Close diff view |
:ResolveOurs |
Keep ours (left) |
:ResolveTheirs |
Take theirs (right) |
:ResolveBoth |
Combine both |
:ResolveRestore |
Restore original markers |
:ResolvePick [auto|jj|git] |
File picker (requires snacks.nvim) |
| Key | Action |
|---|---|
<leader>mo |
Keep ours |
<leader>mt |
Take theirs |
<leader>mb |
Both |
<leader>mr |
Restore |
<leader>mp |
Picker |
| Key | Action |
|---|---|
]c / [c |
Next/prev diff hunk |
do |
Get hunk from other side |
dp |
Put hunk to other side |
When Git can't auto-merge, it writes conflict markers into your file:
<<<<<<< HEAD
our changes
||||||| base
original
=======
their changes
>>>>>>> feature
Editing these markers manually is error-prone. A 3-way diff is confusing.
This plugin shows a two-way diff:
- Left (OURS): Your version, editable
- Right (THEIRS): Their version, read-only reference
It works by:
- Reading the file with conflict markers
- Parsing markers with a state machine (NORMAL → OURS → BASE → THEIRS → NORMAL)
- Extracting clean OURS and THEIRS versions (markers stripped)
- Showing side-by-side with vim's
:diffthis - You edit the left side, save with
:w
You can use this standalone or with git mergetool:
# Standalone (recommended)
nvim -c ResolvePick
# Or configure git mergetool
git config --global merge.tool resolver
git config --global mergetool.resolver.cmd 'nvim "$MERGED" -c Resolve'
git config --global mergetool.resolver.trustExitCode trueWith standalone approach, you control the flow. With git mergetool, git opens each file one at a time.
- JJ conflict markers are supported (diff, snapshot, and git-style; including long markers).
:ResolvePickprefers JJ when a JJ workspace is detected.- Use
:ResolvePick jj|git|autoto override backend selection. - Multi-sided JJ conflicts are collapsed to two sides (first and last).
- JJ conflict marker support (diff, snapshot, git-style)
- JJ-first picker backend with
jj resolve --list :ResolvePick [auto|jj|git]backend override- Long marker support
- Initial release
- Git diff3 conflict marker support
- Two-way diff view
:ResolvePickwith snacks.nvim
vim-diffconflicts by Seth House — Watch the explanation
BSD 3-Clause