mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2024-09-16 14:34:09 +02:00
feat(blame): add reblame at commit parent
This commit is contained in:
parent
2a7b39f4d2
commit
f4928ba14e
1 changed files with 13 additions and 1 deletions
|
@ -152,10 +152,14 @@ end
|
|||
--- @param blame table<integer,Gitsigns.BlameInfo?>
|
||||
--- @param win integer
|
||||
--- @param revision? string
|
||||
local function reblame(blame, win, revision)
|
||||
--- @param parent? boolean
|
||||
local function reblame(blame, win, revision, parent)
|
||||
local blm_win = api.nvim_get_current_win()
|
||||
local lnum = unpack(api.nvim_win_get_cursor(blm_win))
|
||||
local sha = blame[lnum].commit.sha
|
||||
if parent then
|
||||
sha = sha .. '^'
|
||||
end
|
||||
if sha == revision then
|
||||
return
|
||||
end
|
||||
|
@ -324,6 +328,13 @@ M.blame = function()
|
|||
buffer = blm_bufnr,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', 'R', function()
|
||||
reblame(blame, win, bcache.git_obj.revision, true)
|
||||
end, {
|
||||
desc = 'Reblame at commit parent',
|
||||
buffer = blm_bufnr,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', 's', function()
|
||||
show_commit(blm_win, 'vsplit', bcache)
|
||||
end, {
|
||||
|
@ -340,6 +351,7 @@ M.blame = function()
|
|||
|
||||
menu('GitsignsBlame', {
|
||||
{ 'Reblame at commit', 'r' },
|
||||
{ 'Reblame at commit parent', 'R' },
|
||||
{ 'Show commit (vsplit)', 's' },
|
||||
{ ' (tab)', 'S' },
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue