49 lines
1.1 KiB
Lua
49 lines
1.1 KiB
Lua
return {
|
|
"lewis6991/gitsigns.nvim",
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
config = function()
|
|
require("gitsigns").setup({
|
|
signs = {
|
|
add = { text = "│" },
|
|
change = { text = "│" },
|
|
delete = { text = "_" },
|
|
topdelete = { text = "‾" },
|
|
changedelete = { text = "~" },
|
|
untracked = { text = "┆" },
|
|
},
|
|
on_attach = function(bufnr)
|
|
local gs = package.loaded.gitsigns
|
|
|
|
local function map(mode, l, r, opts)
|
|
opts = opts or {}
|
|
opts.buffer = bufnr
|
|
vim.keymap.set(mode, l, r, opts)
|
|
end
|
|
|
|
map("n", "]h", function()
|
|
if vim.wo.diff then
|
|
return "]h"
|
|
end
|
|
vim.schedule(function()
|
|
gs.next_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, silent = true })
|
|
|
|
map("n", "[h", function()
|
|
if vim.wo.diff then
|
|
return "[h"
|
|
end
|
|
vim.schedule(function()
|
|
gs.prev_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, silent = true })
|
|
|
|
map("n", "<leader>ph", gs.preview_hunk, { silent = true })
|
|
map("n", "<leader>tb", gs.toggle_current_line_blame, { silent = true })
|
|
end,
|
|
})
|
|
end,
|
|
}
|