mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
I guess it is due to the reason that we are doing constant git fetch, and somehow gitsigns word diff is affected. Changing the gitsigns debounce or changing lualine refresh rate do not seem to help. So gitsigns word diff is disabled.
58 lines
1.3 KiB
Lua
58 lines
1.3 KiB
Lua
local gs = require("gitsigns")
|
|
|
|
gs.setup {
|
|
signs = {
|
|
add = { text = "+" },
|
|
change = { text = "~" },
|
|
delete = { text = "_" },
|
|
topdelete = { text = "‾" },
|
|
changedelete = { text = "│" },
|
|
},
|
|
word_diff = false,
|
|
on_attach = function(bufnr)
|
|
local function map(mode, l, r, opts)
|
|
opts = opts or {}
|
|
opts.buffer = bufnr
|
|
vim.keymap.set(mode, l, r, opts)
|
|
end
|
|
|
|
-- Navigation
|
|
map("n", "]c", function()
|
|
if vim.wo.diff then
|
|
return "]c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.next_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, desc = "next hunk" })
|
|
|
|
map("n", "[c", function()
|
|
if vim.wo.diff then
|
|
return "[c"
|
|
end
|
|
vim.schedule(function()
|
|
gs.prev_hunk()
|
|
end)
|
|
return "<Ignore>"
|
|
end, { expr = true, desc = "previous hunk" })
|
|
|
|
-- Actions
|
|
map("n", "<leader>hp", gs.preview_hunk, { desc = "preview hunk" })
|
|
map("n", "<leader>hb", function()
|
|
gs.blame_line { full = true }
|
|
end, { desc = "blame hunk" })
|
|
end,
|
|
}
|
|
|
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
|
pattern = "*",
|
|
callback = function()
|
|
vim.cmd([[
|
|
hi GitSignsChangeInline gui=reverse
|
|
hi GitSignsAddInline gui=reverse
|
|
hi GitSignsDeleteInline gui=reverse
|
|
]])
|
|
end,
|
|
})
|