init.lua/lua/configs/gitsigns.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
require("gitsigns").setup {
max_file_length = 1000,
current_line_blame = true,
current_line_blame_opts = {
virt_text_pos = "eol",
delay = 300,
},
on_attach = function(bufnr)
local g = package.loaded.gitsigns
local map = function(from, to)
vim.keymap.set("n", from, to, {
buffer = bufnr,
noremap = true,
silent = true,
})
end
map("<leader>gj", g.next_hunk)
map("<leader>gk", g.prev_hunk)
map("<leader>gs", g.stage_hunk)
map("<leader>gu", g.undo_stage_hunk)
map("<leader>gr", g.reset_hunk)
map("<leader>gp", g.preview_hunk)
map("<leader>gb", g.blame_line)
map("<leader>gd", g.diffthis)
end,
}
|