refactor: some small improvments to unimportant commits

This commit is contained in:
Folke Lemaitre 2023-03-02 14:10:19 +01:00
commit a15126b2de
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 17 additions and 14 deletions

View file

@ -9,6 +9,7 @@ M.colors = {
CommitIssue = "Number", CommitIssue = "Number",
CommitType = "Title", -- conventional commit type CommitType = "Title", -- conventional commit type
CommitScope = "Italic", -- conventional commit scope CommitScope = "Italic", -- conventional commit scope
Dimmed = "Conceal", -- property
Prop = "Conceal", -- property Prop = "Conceal", -- property
Value = "@string", -- value of a property Value = "@string", -- value of a property
NoCond = "DiagnosticWarn", -- unloaded icon for a plugin where `cond()` was false NoCond = "DiagnosticWarn", -- unloaded icon for a plugin where `cond()` was false

View file

@ -24,6 +24,8 @@ function M.get_commands()
return ret return ret
end end
M.dimmed_commits = { "build", "ci", "chore", "doc" }
M.keys = { M.keys = {
hover = "K", hover = "K",
diff = "d", diff = "d",

View file

@ -456,21 +456,21 @@ function M:log(task)
self:diagnostic({ message = "Breaking Changes", severity = vim.diagnostic.severity.WARN }) self:diagnostic({ message = "Breaking Changes", severity = vim.diagnostic.severity.WARN })
end end
self:append(ref:sub(1, 7) .. " ", "LazyCommit", { indent = 6 }) self:append(ref:sub(1, 7) .. " ", "LazyCommit", { indent = 6 })
if msg:match([[^chore]]) or msg:match([[^ci]]) or msg:match([[^doc]]) then
self:append(vim.trim(msg)):highlight({ local dimmed = false
["."] = "LazyComment", for _, dim in ipairs(ViewConfig.dimmed_commits) do
}) if msg:find("^" .. dim) then
else dimmed = true
self:append(vim.trim(msg)):highlight({ end
["#%d+"] = "LazyCommitIssue",
["^%S+:"] = "LazyCommitType",
["^%S+(%(.*%)):"] = "LazyCommitScope",
["`.-`"] = "@text.literal.markdown_inline",
["%*.-%*"] = "Italic",
["%*%*.-%*%*"] = "Bold",
})
end end
-- string.gsub self:append(vim.trim(msg), dimmed and "LazyDimmed" or nil):highlight({
["#%d+"] = "LazyCommitIssue",
["^%S+:"] = dimmed and "Bold" or "LazyCommitType",
["^%S+(%(.*%)):"] = "LazyCommitScope",
["`.-`"] = "@text.literal.markdown_inline",
["%*.-%*"] = "Italic",
["%*%*.-%*%*"] = "Bold",
})
self:append(" " .. time, "LazyComment") self:append(" " .. time, "LazyComment")
self:nl() self:nl()
end end