From fadcd0bd28f9aab8fdd2d23c9877fb4ef6a16d98 Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Fri, 9 Oct 2026 16:49:00 +0200 Subject: [PATCH] fix(config): drop `q` default from `keymaps.worktree_overview` --- doc/diffview.txt | 3 ++- doc/diffview_defaults.txt | 1 - lua/diffview/config.lua | 1 - .../tests/functional/worktree_overview_view_spec.lua | 6 +----- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/diffview.txt b/doc/diffview.txt index d158024f..125adb68 100644 --- a/doc/diffview.txt +++ b/doc/diffview.txt @@ -604,10 +604,11 @@ COMMANDS *diffview-commands* tabpage listing every linked git worktree. Default keymaps on the overview buffer: > - q close the overview R re-scan worktrees open DiffView for the selected worktree < + Close the overview with |:DiffviewClose| (same as + every other diffview tab). Git only. *:DiffviewLog* diff --git a/doc/diffview_defaults.txt b/doc/diffview_defaults.txt index 148e97fe..57ae875b 100644 --- a/doc/diffview_defaults.txt +++ b/doc/diffview_defaults.txt @@ -361,7 +361,6 @@ DEFAULT CONFIG *diffview.defaults* { "n", "", actions.close, { desc = "Close commit log" } }, }, worktree_overview = { - { "n", "q", actions.close, { desc = "Close the worktree overview" } }, { "n", "R", actions.refresh_files, { desc = "Re-scan worktrees and stats" } }, { "n", "", actions.worktree_overview_enter, { desc = "Open DiffView for the selected worktree" } }, }, diff --git a/lua/diffview/config.lua b/lua/diffview/config.lua index 1b56dff6..ea27abdf 100644 --- a/lua/diffview/config.lua +++ b/lua/diffview/config.lua @@ -777,7 +777,6 @@ M.defaults = { { "n", "", actions.close, { desc = "Close commit log" } }, }, worktree_overview = { - { "n", "q", actions.close, { desc = "Close the worktree overview" } }, { "n", "R", actions.refresh_files, { desc = "Re-scan worktrees and stats" } }, { "n", "", actions.worktree_overview_enter, { desc = "Open DiffView for the selected worktree" } }, }, diff --git a/lua/diffview/tests/functional/worktree_overview_view_spec.lua b/lua/diffview/tests/functional/worktree_overview_view_spec.lua index 4a1bd769..1f9a1847 100644 --- a/lua/diffview/tests/functional/worktree_overview_view_spec.lua +++ b/lua/diffview/tests/functional/worktree_overview_view_spec.lua @@ -62,15 +62,12 @@ describe("diffview.scene.views.worktree_overview WorktreeOverviewView", function view = WorktreeOverviewView({ adapter = make_adapter(repo) }) view:open() - local lhs = { ["q"] = false, ["R"] = false, [""] = false } + local lhs = { ["R"] = false, [""] = false } for _, m in ipairs(vim.api.nvim_buf_get_keymap(view.bufnr, "n")) do -- `nvim_buf_get_keymap` may return `` normalised to the -- literal "\r" in either `m.lhs` or `m.lhsraw` depending on the -- Neovim version; compare every spelling so this test does not -- depend on which form nvim is in the mood for. - if m.lhs == "q" or m.lhsraw == "q" then - lhs["q"] = true - end if m.lhs == "R" or m.lhsraw == "R" then lhs["R"] = true end @@ -78,7 +75,6 @@ describe("diffview.scene.views.worktree_overview WorktreeOverviewView", function lhs[""] = true end end - assert.is_true(lhs["q"]) assert.is_true(lhs["R"]) assert.is_true(lhs[""]) end)