mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 01:08:59 +02:00
feat(git): <leader>gb
for Git Blame Line
This commit is contained in:
parent
32eacde793
commit
9e3af1070f
2 changed files with 19 additions and 0 deletions
|
@ -140,4 +140,22 @@ gui:
|
|||
M.dirty = false
|
||||
end
|
||||
|
||||
---@param opts? {count?: number}|LazyCmdOptions
|
||||
function M.blame_line(opts)
|
||||
opts = vim.tbl_deep_extend("force", {
|
||||
count = 3,
|
||||
filetype = "git",
|
||||
size = {
|
||||
width = 0.6,
|
||||
height = 0.6,
|
||||
},
|
||||
border = "rounded",
|
||||
}, opts or {})
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local line = cursor[1] - 1
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
local cmd = { "git", "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
|
||||
return require("lazy.util").float_cmd(cmd, opts)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue