feat(snacks): use git

This commit is contained in:
Folke Lemaitre 2024-11-04 11:51:23 +01:00
parent 676e700ca0
commit ad698dd0aa
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 2 additions and 23 deletions

View file

@ -1,25 +1,5 @@
---@class lazyvim.util.lazygit
---@param opts? {count?: number}|LazyCmdOptions
function M.blame_line(opts)
opts = vim.tbl_deep_extend("force", {
count = 3,
interactive = false,
float = {
win = {
width = 0.6,
height = 0.6,
border = "rounded",
},
bo = { filetype = "git" },
},
}, opts or {})
local cursor = vim.api.nvim_win_get_cursor(0)
local line = cursor[1]
local file = vim.api.nvim_buf_get_name(0)
local root = LazyVim.root.detectors.pattern(0, { ".git" })[1] or "."
local cmd = { "git", "-C", root, "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
return Snacks.terminal(cmd, opts)
end
local M = {}
-- stylua: ignore
M.remote_patterns = {