Skip to content

Commit 1f7ffec

Browse files
kylo252folke
andauthored
feat(render): dim housekeeping commits by default (#612)
* feat(render): dim housekeeping commits by default use `LazyComment` highlight group for commits with housekeeping types, i.e. chore/ci/doc * refactor: some small improvments to unimportant commits --------- Co-authored-by: Folke Lemaitre <[email protected]>
1 parent 26d121e commit 1f7ffec

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lua/lazy/view/colors.lua

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ M.colors = {
99
CommitIssue = "Number",
1010
CommitType = "Title", -- conventional commit type
1111
CommitScope = "Italic", -- conventional commit scope
12+
Dimmed = "Conceal", -- property
1213
Prop = "Conceal", -- property
1314
Value = "@string", -- value of a property
1415
NoCond = "DiagnosticWarn", -- unloaded icon for a plugin where `cond()` was false

lua/lazy/view/config.lua

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ function M.get_commands()
2424
return ret
2525
end
2626

27+
M.dimmed_commits = { "build", "ci", "chore", "doc" }
28+
2729
M.keys = {
2830
hover = "K",
2931
diff = "d",

lua/lazy/view/render.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,21 @@ function M:log(task)
456456
self:diagnostic({ message = "Breaking Changes", severity = vim.diagnostic.severity.WARN })
457457
end
458458
self:append(ref:sub(1, 7) .. " ", "LazyCommit", { indent = 6 })
459-
self:append(vim.trim(msg)):highlight({
459+
460+
local dimmed = false
461+
for _, dim in ipairs(ViewConfig.dimmed_commits) do
462+
if msg:find("^" .. dim) then
463+
dimmed = true
464+
end
465+
end
466+
self:append(vim.trim(msg), dimmed and "LazyDimmed" or nil):highlight({
460467
["#%d+"] = "LazyCommitIssue",
461-
["^%S+:"] = "LazyCommitType",
468+
["^%S+:"] = dimmed and "Bold" or "LazyCommitType",
462469
["^%S+(%(.*%)):"] = "LazyCommitScope",
463470
["`.-`"] = "@text.literal.markdown_inline",
464471
["%*.-%*"] = "Italic",
465472
["%*%*.-%*%*"] = "Bold",
466473
})
467-
-- string.gsub
468474
self:append(" " .. time, "LazyComment")
469475
self:nl()
470476
end

0 commit comments

Comments
 (0)