mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-11-14 04:11:13 +00:00
45 lines
1.3 KiB
Lua
45 lines
1.3 KiB
Lua
local status_ok, gitsigns = pcall(require, "gitsigns")
|
|
if not status_ok then
|
|
return
|
|
end
|
|
|
|
gitsigns.setup({
|
|
signs = {
|
|
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
|
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
|
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
|
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
|
changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
|
},
|
|
signcolumn = true,
|
|
watch_gitdir = {
|
|
interval = 1000,
|
|
follow_files = true,
|
|
},
|
|
attach_to_untracked = true,
|
|
sign_priority = 6,
|
|
update_debounce = 100,
|
|
status_formatter = nil,
|
|
preview_config = {
|
|
border = "rounded",
|
|
style = "minimal",
|
|
relative = "cursor",
|
|
row = 0,
|
|
col = 1,
|
|
},
|
|
|
|
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", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
|
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
|
map("n", "<leader>hR", gs.reset_buffer)
|
|
end,
|
|
})
|