mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-16 04:14:37 +02:00
feat(snacks): use git
This commit is contained in:
parent
676e700ca0
commit
ad698dd0aa
2 changed files with 2 additions and 23 deletions
|
@ -130,11 +130,10 @@ if vim.lsp.inlay_hint then
|
|||
end
|
||||
|
||||
-- lazygit
|
||||
map("n", "<leader>gb", LazyVim.lazygit.blame_line, { desc = "Git Blame Line" })
|
||||
map("n", "<leader>gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
|
||||
map("n", "<leader>gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" })
|
||||
map("n", "<leader>gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" })
|
||||
map("n", "<leader>gB", LazyVim.lazygit.browse, { desc = "Git Browse" })
|
||||
|
||||
map("n", "<leader>gf", function() Snacks.lazygit.log_file() end, { desc = "Lazygit Current File History" })
|
||||
map("n", "<leader>gl", function() Snacks.lazygit.log({ cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" })
|
||||
map("n", "<leader>gL", function() Snacks.lazygit.log() end, { desc = "Lazygit Log (cwd)" })
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue