diff --git a/README.md b/README.md index bd7358dd..6ce61da2 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ set of paths, and view the changes made in a diff split. This is a porcelain interface for git-log, and supports a good number of its options. Things like: - Filtering commits by grepping commit messages and commit authors. -- Tracing the line evolution of a given set of line ranges for multiple files. +- Tracing the line evolution of a given set of line ranges for multiple files. - Only listing changes for a specific commit range, branch, or tag. - Following file changes through renames. @@ -175,7 +175,7 @@ require("diffview").setup({ }, view = { -- Configure the layout and behavior of different types of views. - -- Available layouts: + -- Available layouts: -- 'diff1_plain' -- |'diff2_horizontal' -- |'diff2_vertical' diff --git a/doc/diffview.txt b/doc/diffview.txt index 30fe72aa..8c10566a 100644 --- a/doc/diffview.txt +++ b/doc/diffview.txt @@ -651,6 +651,15 @@ keymaps *diffview-config-keymaps* } < + Setting a mapping's `desc` field to `"diffview_ignore"` will hide the + mapping from the help panel: > + + view = { + -- Ignore mapping in the help panel + { "n", "<2-LeftMouse>", actions.select_entry, { desc = "diffview_ignore" } }, + } +< + To disable all the default mappings simply set: > keymaps = { diff --git a/lua/diffview/ui/panels/help_panel.lua b/lua/diffview/ui/panels/help_panel.lua index 6e66a091..5e50cc49 100644 --- a/lua/diffview/ui/panels/help_panel.lua +++ b/lua/diffview/ui/panels/help_panel.lua @@ -149,7 +149,6 @@ function HelpPanel:update_components() return a < b end) - height = height + #maps + 3 local items = { name = "items" } local section_schema = { name = "section", @@ -163,17 +162,22 @@ function HelpPanel:update_components() } for _, mapping in ipairs(maps) do - width = math.max(width, 14 + 4 + #mapping[5] + 2) - table.insert(items, { - name = "item", - context = { - label_lhs = ("%14s"):format(mapping[2]), - label_rhs = ("%s"):format(mapping[5]), - mapping = mapping, - }, - }) + local desc = mapping[5] + + if desc ~= "diffview_ignore" then + width = math.max(width, 14 + 4 + #mapping[5] + 2) + table.insert(items, { + name = "item", + context = { + label_lhs = ("%14s"):format(mapping[2]), + label_rhs = desc, + mapping = mapping, + }, + }) + end end + height = height + #items + 3 table.insert(sections, section_schema) end