Skip to content

Commit 4b57b6c

Browse files
committed
docs: Update default config.
1 parent 3f3d7a3 commit 4b57b6c

File tree

2 files changed

+58
-50
lines changed

2 files changed

+58
-50
lines changed

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ require("diffview").setup({
246246
{ "n", "<leader>cb", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } },
247247
{ "n", "<leader>ca", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } },
248248
{ "n", "dx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } },
249+
{ "n", "g?", actions.help("view"), { desc = "Open the help panel" } },
249250
},
250251
diff1 = { --[[ Mappings in single window diff layouts ]] },
251252
diff2 = { --[[ Mappings in 2-way diff layouts ]] },
@@ -288,35 +289,38 @@ require("diffview").setup({
288289
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
289290
{ "n", "[x", actions.prev_conflict, { desc = "Go to the previous conflict" } },
290291
{ "n", "]x", actions.next_conflict, { desc = "Go to the next conflict" } },
292+
{ "n", "g?", actions.help("file_panel"), { desc = "Open the help panel" } },
291293
},
292294
file_history_panel = {
293-
{ "n", "g!", actions.options, { desc = "Open the option panel" } },
294-
{ "n", "<C-A-d>", actions.open_in_diffview, { desc = "Open the entry under the cursor in a diffview" } },
295-
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
296-
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
297-
{ "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } },
298-
{ "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } },
299-
{ "n", "j", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
300-
{ "n", "<down>", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
301-
{ "n", "k", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
302-
{ "n", "<up>", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
303-
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
304-
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
305-
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
306-
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
307-
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
308-
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
309-
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
310-
{ "n", "gf", actions.goto_file, { desc = "Open the file in a new split in the previous tabpage" } },
311-
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
312-
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
313-
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
314-
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
315-
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
295+
{ "n", "g!", actions.options, { desc = "Open the option panel" } },
296+
{ "n", "<C-A-d>", actions.open_in_diffview, { desc = "Open the entry under the cursor in a diffview" } },
297+
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
298+
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
299+
{ "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } },
300+
{ "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } },
301+
{ "n", "j", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
302+
{ "n", "<down>", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
303+
{ "n", "k", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
304+
{ "n", "<up>", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
305+
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
306+
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
307+
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
308+
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
309+
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
310+
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
311+
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
312+
{ "n", "gf", actions.goto_file, { desc = "Open the file in a new split in the previous tabpage" } },
313+
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
314+
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
315+
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
316+
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
317+
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
318+
{ "n", "g?", actions.help("file_history_panel"), { desc = "Open the help panel" } },
316319
},
317320
option_panel = {
318-
{ "n", "<tab>", actions.select_entry, { desc = "Change the current option" } },
319-
{ "n", "q", actions.close, { desc = "Close the panel" } },
321+
{ "n", "<tab>", actions.select_entry, { desc = "Change the current option" } },
322+
{ "n", "q", actions.close, { desc = "Close the panel" } },
323+
{ "n", "g?", actions.help("option_panel"), { desc = "Open the help panel" } },
320324
},
321325
help_panel = {
322326
{ "n", "q", actions.close, { desc = "Close help menu" } },

doc/diffview_defaults.txt

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ require("diffview").setup({
100100
{ "n", "<leader>cb", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } },
101101
{ "n", "<leader>ca", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } },
102102
{ "n", "dx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } },
103+
{ "n", "g?", actions.help("view"), { desc = "Open the help panel" } },
103104
},
104105
diff1 = { --[[ Mappings in single window diff layouts ]] },
105106
diff2 = { --[[ Mappings in 2-way diff layouts ]] },
@@ -142,35 +143,38 @@ require("diffview").setup({
142143
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
143144
{ "n", "[x", actions.prev_conflict, { desc = "Go to the previous conflict" } },
144145
{ "n", "]x", actions.next_conflict, { desc = "Go to the next conflict" } },
146+
{ "n", "g?", actions.help("file_panel"), { desc = "Open the help panel" } },
145147
},
146148
file_history_panel = {
147-
{ "n", "g!", actions.options, { desc = "Open the option panel" } },
148-
{ "n", "<C-A-d>", actions.open_in_diffview, { desc = "Open the entry under the cursor in a diffview" } },
149-
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
150-
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
151-
{ "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } },
152-
{ "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } },
153-
{ "n", "j", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
154-
{ "n", "<down>", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
155-
{ "n", "k", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
156-
{ "n", "<up>", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
157-
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
158-
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
159-
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
160-
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
161-
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
162-
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
163-
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
164-
{ "n", "gf", actions.goto_file, { desc = "Open the file in a new split in the previous tabpage" } },
165-
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
166-
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
167-
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
168-
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
169-
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
149+
{ "n", "g!", actions.options, { desc = "Open the option panel" } },
150+
{ "n", "<C-A-d>", actions.open_in_diffview, { desc = "Open the entry under the cursor in a diffview" } },
151+
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
152+
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
153+
{ "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } },
154+
{ "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } },
155+
{ "n", "j", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
156+
{ "n", "<down>", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
157+
{ "n", "k", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
158+
{ "n", "<up>", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
159+
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
160+
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
161+
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
162+
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
163+
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
164+
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
165+
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
166+
{ "n", "gf", actions.goto_file, { desc = "Open the file in a new split in the previous tabpage" } },
167+
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
168+
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
169+
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
170+
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
171+
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
172+
{ "n", "g?", actions.help("file_history_panel"), { desc = "Open the help panel" } },
170173
},
171174
option_panel = {
172-
{ "n", "<tab>", actions.select_entry, { desc = "Change the current option" } },
173-
{ "n", "q", actions.close, { desc = "Close the panel" } },
175+
{ "n", "<tab>", actions.select_entry, { desc = "Change the current option" } },
176+
{ "n", "q", actions.close, { desc = "Close the panel" } },
177+
{ "n", "g?", actions.help("option_panel"), { desc = "Open the help panel" } },
174178
},
175179
help_panel = {
176180
{ "n", "q", actions.close, { desc = "Close help menu" } },

0 commit comments

Comments
 (0)