Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jj-conflict.nvim

2026-04-03.03-15-05.mov

A Neovim plugin to visualize and resolve Jujutsu (jj) merge conflicts, inspired by git-conflict.nvim.

Requirements

Installation

lazy.nvim

{
    'larpios/jj-conflict.nvim',
    -- If you want to use the latest tagged version
    -- version = '*',
    event = { 'BufReadPre', 'BufNewFile' },
    cmd = {
        'JjConflictList',
        'JjConflictChooseBoth',
        'JjConflictChooseNone',
        'JjConflictChooseOurs',
        'JjConflictChooseTheirs',
        'JjConflictNextConflict',
        'JjConflictPrevConflict',
        'JjConflictSquash',
        'JjConflictResolve',
        'JjConflictLog',
        'JjConflictStatus',
        'JjConflictDiff',
    },
    config = true
}

Configuration

The following options are the default values:

require('jj-conflict').setup({
    -- Whether to automatically setup default mappings
	default_mappings = true,
    -- Whether to automatically setup default commands
	default_commands = true,
    -- Whether to enable notifications
    notify = true,
    -- Prefix for keybinding descriptions
    desc_prefix = nil,
    -- Highlight groups
	highlights = {
		ours = "DiffAdd",
		theirs = "DiffText",
		marker = "CursorLine",
		label = "Comment",
		diff_remove = "DiffDelete",
		diff_add = "DiffAdd",
	},
    -- Custom mappings
	mappings = {
		ours = "Ho",
		theirs = "Ht",
		both = "Hb",
		base = "H0",
		next = "Hn",
		prev = "Hp",
	},
})

Commands

Command Description
:JjConflictChooseOurs Select our side
:JjConflictChooseTheirs Select their side
:JjConflictChooseBoth Select both sides
:JjConflictChooseNone Select none
:JjConflictNextConflict Jump to next conflict
:JjConflictPrevConflict Jump to previous conflict
:JjConflictList List conflicts in a UI picker
:JConflictjSquash Pick a revision from jj log and squash current changes into it
:JConflictjResolve Run jj resolve for the current buffer
:JConflictjLog Show jj log in a picker
:JConflictjStatus Show modified/conflicted files from jj status in a picker
:JConflictjDiff Show jj diff for the current buffer

Lualine Support

The plugin provides a statusline module that optionally exposes the current jj workspace ID alongside the conflict count.

-- In your lualine config:
require('lualine').setup({
  sections = {
    lualine_c = {
      {
        require('jj-conflict.statusline').get_status,
        cond = function() return require('jj-conflict.api').has_conflicts(0) end,
      }
    }
  }
})

How It Works

Unlike Git, Jujutsu uses a different conflict marker format that shows diffs:

<<<<<<< conflict 1 of 1
%%%%%%% diff from: abc123 "base commit"
\\\\\\\        to: def456 "our commit"
-old line
+new line
+++++++ ghi789 "their commit"
their content here
>>>>>>> conflict 1 of 1 ends

The plugin detects these markers, highlights them, and provides commands to resolve the conflict by picking one or both sides.

About

Neovim plugin for resolving, and visualizing Jujutsu conflicts

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages