config.nvim/lua/plugins/gitsigns.lua

53 lines
1.8 KiB
Lua
Raw Normal View History

2021-10-25 12:10:08 +08:00
require('gitsigns').setup {
keymaps = {
-- Default keymap options
buffer = true,
noremap = true,
["n ]c"] = {
expr = true,
"&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"
},
["n [c"] = {
expr = true,
"&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"
},
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>'
},
2022-05-03 14:36:01 +08:00
-- signs
status_formatter = nil, -- Use default
numhl = false,
sign_priority = 10,
2022-05-04 21:58:26 +08:00
attach_to_untracked = false, -- fix gitsigns with yadm in ~
2021-10-25 12:10:08 +08:00
signs = {
2022-05-03 14:36:01 +08:00
add = {hl = "DiffAdd", text = "+", numhl = "GitSignsAddNr"},
change = {hl = "DiffChange", text = ">", numhl = "GitSignsChangeNr"},
2021-10-25 12:10:08 +08:00
changedelete = {
hl = "DiffChange",
text = "~",
numhl = "GitSignsChangeNr"
},
delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"},
topdelete = {
hl = "DiffDelete",
text = "",
numhl = "GitSignsDeleteNr"
}
},
2022-05-03 14:36:01 +08:00
yadm = {enable = true},
2021-10-25 12:10:08 +08:00
2022-05-03 14:36:01 +08:00
-- Current line blame
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 250,
ignore_whitespace = false
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>'
2021-10-25 12:10:08 +08:00
}