Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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'
Expand Down
9 changes: 9 additions & 0 deletions doc/diffview.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
24 changes: 14 additions & 10 deletions lua/diffview/ui/panels/help_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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

Expand Down