From 1f7ffec177656ac806706097d23f288e3a5e0b51 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:25:50 +0100 Subject: [PATCH] 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 --- lua/lazy/view/colors.lua | 1 + lua/lazy/view/config.lua | 2 ++ lua/lazy/view/render.lua | 12 +++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lua/lazy/view/colors.lua b/lua/lazy/view/colors.lua index 550ed09..333af82 100644 --- a/lua/lazy/view/colors.lua +++ b/lua/lazy/view/colors.lua @@ -9,6 +9,7 @@ M.colors = { CommitIssue = "Number", CommitType = "Title", -- conventional commit type CommitScope = "Italic", -- conventional commit scope + Dimmed = "Conceal", -- property Prop = "Conceal", -- property Value = "@string", -- value of a property NoCond = "DiagnosticWarn", -- unloaded icon for a plugin where `cond()` was false diff --git a/lua/lazy/view/config.lua b/lua/lazy/view/config.lua index 1f38540..6c73d40 100644 --- a/lua/lazy/view/config.lua +++ b/lua/lazy/view/config.lua @@ -24,6 +24,8 @@ function M.get_commands() return ret end +M.dimmed_commits = { "build", "ci", "chore", "doc" } + M.keys = { hover = "K", diff = "d", diff --git a/lua/lazy/view/render.lua b/lua/lazy/view/render.lua index b84fb0f..00f4072 100644 --- a/lua/lazy/view/render.lua +++ b/lua/lazy/view/render.lua @@ -456,15 +456,21 @@ function M:log(task) self:diagnostic({ message = "Breaking Changes", severity = vim.diagnostic.severity.WARN }) end self:append(ref:sub(1, 7) .. " ", "LazyCommit", { indent = 6 }) - self:append(vim.trim(msg)):highlight({ + + local dimmed = false + for _, dim in ipairs(ViewConfig.dimmed_commits) do + if msg:find("^" .. dim) then + dimmed = true + end + end + self:append(vim.trim(msg), dimmed and "LazyDimmed" or nil):highlight({ ["#%d+"] = "LazyCommitIssue", - ["^%S+:"] = "LazyCommitType", + ["^%S+:"] = dimmed and "Bold" or "LazyCommitType", ["^%S+(%(.*%)):"] = "LazyCommitScope", ["`.-`"] = "@text.literal.markdown_inline", ["%*.-%*"] = "Italic", ["%*%*.-%*%*"] = "Bold", }) - -- string.gsub self:append(" " .. time, "LazyComment") self:nl() end