nix/config/nvim/lua/plugins/git.lua
2026-02-11 12:01:49 -05:00

74 lines
2.3 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---@type string|nil
local prev_gitsigns_signcol = nil
return {
{
'tpope/vim-fugitive',
cmd = { 'Git', 'G', 'Gread', 'Gwrite', 'Gdiffsplit', 'Gvdiffsplit' },
},
{
dir = '~/dev/diffs.nvim',
'barrettruth/diffs.nvim',
init = function()
vim.g.diffs = {
debug = false,
hide_prefix = true,
highlights = {
vim = {
enabled = true,
},
intra = {
enabled = true,
max_lines = 500,
},
},
}
end,
},
{
-- TODO: find out a way to remove this/better overall github integration
'folke/snacks.nvim',
---@type snacks.Config
opts = { gitbrowse = {} },
keys = {
{ '<leader>Go', '<cmd>lua Snacks.gitbrowse()<cr>' },
{ '<leader>Gi', '<cmd>lua Snacks.picker.gh_issue()<cr>' },
{ '<leader>Gp', '<cmd>lua Snacks.picker.gh_pr()<cr>' },
},
},
{
'lewis6991/gitsigns.nvim',
keys = {
{ '[g', '<cmd>Gitsigns next_hunk<cr>' },
{ ']g', '<cmd>Gitsigns prev_hunk<cr>' },
{ '<leader>Gb', '<cmd>Gitsigns toggle_current_line_blame<cr>' },
{
'<leader>Gs',
function()
if vim.opt.signcolumn:get() == 'no' then
prev_gitsigns_signcol = vim.opt.signcolumn:get()
vim.opt.signcolumn = 'yes'
else
vim.opt.signcolumn = prev_gitsigns_signcol
end
vim.cmd.Gitsigns('toggle_signs')
end,
},
},
event = 'VeryLazy',
opts = {
current_line_blame_formatter_nc = function()
return {}
end,
signs = {
-- use boxdraw chars
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '' },
},
signcolumn = false,
},
},
}