A Neovim plugin that helps you quickly navigate and resolve merge conflicts with customizable keybindings.
<<<<<<< HEAD) – keeps your local changes.>>>>>>> ...) – keeps the incoming changes.{
"StackInTheWild/headhunter.nvim",
config = function()
require("headhunter").setup()
end,
}
Customize inline with lazy.nvim if you need different bindings:
{
"StackInTheWild/headhunter.nvim",
config = function()
require("headhunter").setup({
enabled = true, -- set to false to opt out entirely
keys = {
next = "]c", -- remap `]g` → `]c`
prev = "[c", -- remap `[g` → `[c`
quickfix = false, -- disable the quickfix opener
-- omit other keys to keep their defaults
},
})
end,
}
Headhunter ships with the following keys defaults:
keys = {
prev = "[g",
next = "]g",
take_head = "<leader>gh",
take_origin = "<leader>go",
take_both = "<leader>gb",
quickfix = "<leader>gq",
}
These expand to normal-mode commands:
keys.prev ([g) → :HeadhunterPreviouskeys.next (]g) → :HeadhunterNextkeys.take_head (<leader>gh) → :HeadhunterTakeHeadkeys.take_origin (<leader>go) → :HeadhunterTakeOriginkeys.take_both (<leader>gb) → :HeadhunterTakeBothkeys.quickfix (<leader>gq) → :HeadhunterQuickfixTo disable every keybindings, set keys = false.
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 changestheir changes |
Notes:
We use plenary.nvim
make test