From add56267530b22005c092446290528285c633d25 Mon Sep 17 00:00:00 2001 From: Johannes Kresner Date: Mon, 30 Nov 2026 12:57:49 +0100 Subject: [PATCH] feat: add keymap for codediff --- lua/plugins/whichkey.lua | 4 ++++ lua/plugins/workflow.lua | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index c95577e..46a8be5 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -16,6 +16,10 @@ if vim.g.profile == "full" then { "m", group = "Markdown" }, { "o", group = "Tasks" }, { "x", group = "Diagnostics lists" }, + -- Only filled inside a CodeDiff tab; which-key hides empty groups elsewhere. + { "v", group = "Diff view" }, + { "ä", group = "Next" }, + { "ö", group = "Previous" }, }) end diff --git a/lua/plugins/workflow.lua b/lua/plugins/workflow.lua index 5aaa45b..05392cd 100644 --- a/lua/plugins/workflow.lua +++ b/lua/plugins/workflow.lua @@ -95,6 +95,44 @@ return { "esmuellert/codediff.nvim", cond = full, cmd = "CodeDiff", + -- In-tab maps under v so which-key lists them; ä / ö stand in for ] / [ on QWERTZ. + opts = { + keymaps = { + view = { + quit = { "q", "vq" }, + toggle_explorer = "ve", + focus_explorer = "vE", + next_hunk = "äc", + prev_hunk = "öc", + next_file = "äf", + prev_file = "öf", + diff_get = { "do", "vo" }, + diff_put = { "dp", "vp" }, + open_in_prev_tab = "vf", + toggle_stage = { "-", "va" }, + toggle_staged_view = "vS", + stage_hunk = "vs", + unstage_hunk = "vu", + discard_hunk = "vr", + align_move = "vm", + toggle_layout = "vl", + toggle_compact = "vz", + show_help = "v?", + }, + conflict = { + accept_incoming = "vi", + accept_current = "vc", + accept_both = "vb", + discard = "vx", + accept_all_incoming = "vI", + accept_all_current = "vC", + accept_all_both = "vB", + discard_all = "vX", + next_conflict = "äx", + prev_conflict = "öx", + }, + }, + }, keys = { { "gd", "CodeDiff", desc = "Diff status" }, { "gm", "CodeDiff main...", desc = "Diff from main" },