add blame.nvim
This commit is contained in:
parent
6d47537945
commit
349218ca9d
@ -4,7 +4,6 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim", -- required
|
"nvim-lua/plenary.nvim", -- required
|
||||||
"sindrets/diffview.nvim", -- optional - Diff integration
|
"sindrets/diffview.nvim", -- optional - Diff integration
|
||||||
|
|
||||||
-- Only one of these is needed.
|
-- Only one of these is needed.
|
||||||
"nvim-telescope/telescope.nvim", -- optional
|
"nvim-telescope/telescope.nvim", -- optional
|
||||||
"ibhagwan/fzf-lua", -- optional
|
"ibhagwan/fzf-lua", -- optional
|
||||||
@ -24,5 +23,71 @@ return {
|
|||||||
|
|
||||||
vim.keymap.set('n', '<leader>h', gitsigns.next_hunk, { noremap = true, silent = true })
|
vim.keymap.set('n', '<leader>h', gitsigns.next_hunk, { noremap = true, silent = true })
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"FabijanZulj/blame.nvim",
|
||||||
|
lazy = false,
|
||||||
|
colors = {
|
||||||
|
"#b8cc52",
|
||||||
|
"#36a3d9",
|
||||||
|
"#e6e1cf",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('blame').setup {
|
||||||
|
format_fn = function (line_porcelain, config, idx)
|
||||||
|
local utils = require("blame.utils")
|
||||||
|
|
||||||
|
local hash = string.sub(line_porcelain.hash, 0, 7)
|
||||||
|
local line_with_hl = {}
|
||||||
|
local is_commited = hash ~= "0000000"
|
||||||
|
|
||||||
|
if is_commited then
|
||||||
|
local summary
|
||||||
|
if #line_porcelain.summary > config.max_summary_width then
|
||||||
|
summary = string.sub(
|
||||||
|
line_porcelain.summary,
|
||||||
|
0,
|
||||||
|
config.max_summary_width - 3
|
||||||
|
) .. "..."
|
||||||
|
else
|
||||||
|
summary = line_porcelain.summary
|
||||||
|
end
|
||||||
|
line_with_hl = {
|
||||||
|
idx = idx,
|
||||||
|
values = {
|
||||||
|
{
|
||||||
|
textValue = utils.format_time(
|
||||||
|
config.date_format,
|
||||||
|
line_porcelain.committer_time
|
||||||
|
),
|
||||||
|
hl = "Comment",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
textValue = line_porcelain.author .. ":",
|
||||||
|
hl = hash,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
textValue = summary,
|
||||||
|
hl = hash,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format = "%s %s",
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
line_with_hl = {
|
||||||
|
idx = idx,
|
||||||
|
values = {
|
||||||
|
{
|
||||||
|
textValue = "Not commited yet",
|
||||||
|
hl = "Comment",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format = "%s",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
return line_with_hl
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user