Skip to content

feat: accept all incoming/current/both/base for whole file#230

Merged
esmuellert merged 2 commits intomainfrom
dev/main
Feb 7, 2026
Merged

feat: accept all incoming/current/both/base for whole file#230
esmuellert merged 2 commits intomainfrom
dev/main

Conversation

@esmuellert
Copy link
Owner

Summary

Add bulk conflict resolution commands that resolve all conflicts in a file at once, matching VSCode merge editor behavior.

New API functions:

  • accept_all_incoming(tabpage) - Accept all incoming (left/theirs) changes
  • accept_all_current(tabpage) - Accept all current (right/ours) changes
  • accept_all_both(tabpage, first_input) - Accept both sides for all conflicts
  • discard_all(tabpage) - Reset all conflicts to base

Keymaps (matching diffview convention):

Key Action
<leader>cT Accept ALL incoming
<leader>cO Accept ALL current
<leader>cB Accept ALL both
<leader>cX Discard ALL (reset to base)

Implementation details:

  • Processes conflicts bottom-to-top to avoid line offset issues
  • Uses undojoin for atomic undo (single u reverts all changes)
  • Skips already-resolved conflicts
  • Same algorithm as VSCode's acceptAll(), adapted for Neovim APIs

Tests: 10 new tests covering all functions, edge cases, and atomic undo behavior.

Closes #199

Add accept_all_incoming, accept_all_current, accept_all_both, and
discard_all functions that resolve all conflicts in a file at once.

- Process conflicts bottom-to-top with undojoin for atomic undo
- Add keymaps matching diffview convention (uppercase <leader>cT/cO/cB/cX)
- Add comprehensive tests (10 tests covering all functions + atomic undo)

Closes #199
@esmuellert esmuellert enabled auto-merge February 7, 2026 06:29
@esmuellert esmuellert merged commit c2becb3 into main Feb 7, 2026
24 of 25 checks passed
@esmuellert esmuellert deleted the dev/main branch February 7, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept all incoming/current/both/base

1 participant