A Neovim plugin that helps you quickly navigate and resolve merge conflicts with customizable keybindings.
- Jump directly to the next or previous conflict in your repository.
- Quickly resolve conflicts using simple keybindings:
- Take HEAD (
<<<<<<< HEAD
) – keeps your local changes. - Take origin (
>>>>>>> ...
) – keeps the incoming changes. - Take both – keeps both changes, concatenated in order.
- Take HEAD (
- Minimal and fast — pure Lua implementation with no external dependencies.
- Fully customizable keybindings to fit your workflow.
Using lazy.nvim
{
"StackInTheWild/headhunter.nvim",
lazy = true,
opts = {
register_keymaps = false, -- Disable internal keymaps if using lazy.nvim keys
},
keys = {
{ "]g", "<cmd>HeadhunterNext<cr>", desc = "Go to next Conflict" },
{ "[g", "<cmd>HeadhunterPrevious<cr>", desc = "Go to previous Conflict" },
{ "<leader>gh", "<cmd>HeadhunterTakeHead<cr>", desc = "Take changes from HEAD" },
{ "<leader>go", "<cmd>HeadhunterTakeOrigin<cr>", desc = "Take changes from origin" },
{ "<leader>gb", "<cmd>HeadhunterTakeBoth<cr>", desc = "Take both changes" },
},
}
Assuming you are using the keybindings from above:
[g
→ Jump to the previous conflict.]g
→ Jump to the next conflict.
Given a conflict block like this:
<<<<<<< HEAD
my changes
=======
their changes
>>>>>>> branch
Action | Keybinding | Command | Resulting Text in Buffer |
---|---|---|---|
Take HEAD | <leader>gh |
:HeadhunterTakeHead |
my changes |
Take origin | <leader>go |
:HeadhunterTakeOrigin |
their changes |
Take both | <leader>gb |
:HeadhunterTakeBoth |
my changes their changes |
Notes:
- Take HEAD keeps only your local changes.
- Take origin keeps only the incoming changes from the other branch.
- Take both concatenates your changes with the incoming changes, in that order.
We use plenary.nvim
make test