94 lines
3.2 KiB
Lua
94 lines
3.2 KiB
Lua
return {
|
|
{
|
|
"NeogitOrg/neogit",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim", -- required
|
|
"sindrets/diffview.nvim", -- optional - Diff integration
|
|
-- Only one of these is needed.
|
|
"nvim-telescope/telescope.nvim", -- optional
|
|
"ibhagwan/fzf-lua", -- optional
|
|
"echasnovski/mini.pick", -- optional
|
|
},
|
|
},
|
|
{
|
|
"lewis6991/gitsigns.nvim",
|
|
init = function ()
|
|
local gitsigns = require("gitsigns")
|
|
gitsigns.setup()
|
|
|
|
vim.keymap.set('n', '<leader>ph', gitsigns.preview_hunk, { noremap = true, silent = true })
|
|
|
|
vim.keymap.set('n', '<leader>sh', gitsigns.stage_hunk, { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>uh', gitsigns.undo_stage_hunk, { noremap = true, silent = true })
|
|
|
|
vim.keymap.set('n', '<leader>h', gitsigns.next_hunk, { noremap = true, silent = true })
|
|
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,
|
|
},
|
|
}
|