conflicting.nvim allows you to resolve conflicts while highlighting them in style.
The plugin was originally integrated into my LLM code assistant (sia.nvim), but I appreciated its workflow for managing merge conflicts. So here it is: a conflict resolver that is resource-light (it adds no overhead when there are no conflicts) while offering a more visually appealing experience.
Screen.Recording.2025-02-16.at.21.30.08.mov
Screen.Recording.2025-02-16.at.21.33.20.mov
- Track Git repositories for merge conflicts. No overhead for files without conflicts.
- Manually track files for conflicts from other source (e.g., sia.nvim)
- Resolve conflicts:
- Accept current changes
- Accept incoming changes
- Reject all changes
- Diff current and incoming changes
{
"isaksamsten/conflicting.nvim",
--- Optionally bind keys
keys = {
{
"ct",
mode = "n",
function()
require("conflicting").accept_incoming()
end,
desc = "Accept incoming change",
},
{
"co",
mode = "n",
function()
require("conflicting").accept_current()
end,
desc = "Accept current change",
},
{
"cd",
mode = "n",
function()
require("conflicting").diff()
end,
desc = "Diff change",
},
},
config = true,
}{
-- Track conflicts using the following trackers
trackers = { require("conflicting").trackers.git, require("conflicting").trackers.manual },
-- Automatically enable conflicting for all buffers
auto_enable = true,
}Bind the following functions to suitable keys or use the command Conflicting:
require("conflicting").accept_incoming(): accept incoming changes. The same asConflicting incomingrequire("conflicting").accept_current(): accept current changes (reject incoming changes). The same asConflicting current.require("conflicting").accept_both(): accept both changes (and manually edit the conflict). The same asConflicting both.require("conflicting").reject(): reject both changes. The same asConflicting reject.require("conflicting").diff(): open a two-way diff with the current and incoming changes to manually merge the changes. The same asConflicting diff.require("conflicting").quickfix(): add all conflict markers from tracked files to the quickfix list.
conflicting.nvim uses the following highlight groups:
ConflictingOursHeaderlinks toDiffAddby defaultConflictingOurslinks toDiffAddby defaultConflictingTheirslinks toDiffChangeby defaultConflictingTheirsHeaderlinks toDiffChangeby defaultConflictingDelimiterlinks toNormalby default
Since no colorscheme integrates with conflicting.nvim, you need to set the
highlight groups manually to override these defaults. See my
config for inspiration.