1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

fix gitsign word_diff flickering issue (#378)

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.
This commit is contained in:
jdhao 2025-02-16 19:20:21 +01:00 committed by GitHub
parent 2242961925
commit 4b8c490abd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View File

@ -8,7 +8,7 @@ gs.setup {
topdelete = { text = "" }, topdelete = { text = "" },
changedelete = { text = "" }, changedelete = { text = "" },
}, },
word_diff = true, word_diff = false,
on_attach = function(bufnr) on_attach = function(bufnr)
local function map(mode, l, r, opts) local function map(mode, l, r, opts)
opts = opts or {} opts = opts or {}
@ -38,10 +38,10 @@ gs.setup {
end, { expr = true, desc = "previous hunk" }) end, { expr = true, desc = "previous hunk" })
-- Actions -- Actions
map("n", "<leader>hp", gs.preview_hunk) map("n", "<leader>hp", gs.preview_hunk, { desc = "preview hunk" })
map("n", "<leader>hb", function() map("n", "<leader>hb", function()
gs.blame_line { full = true } gs.blame_line { full = true }
end) end, { desc = "blame hunk" })
end, end,
} }

View File

@ -42,7 +42,9 @@ local async_git_status_update = function()
async_cmd(ahead_cmd_str, handle_numeric_result("ahead_count")) async_cmd(ahead_cmd_str, handle_numeric_result("ahead_count"))
end end
local function get_ahead_behind_info() local function get_git_ahead_behind_info()
async_git_status_update()
local status = git_status_cache local status = git_status_cache
if not status then if not status then
return "" return ""
@ -63,9 +65,6 @@ local function get_ahead_behind_info()
return msg return msg
end end
local timer = vim.loop.new_timer()
timer:start(0, 1000, async_git_status_update)
local function spell() local function spell()
if vim.o.spell then if vim.o.spell then
return string.format("[SPELL]") return string.format("[SPELL]")
@ -210,6 +209,9 @@ require("lualine").setup {
section_separators = "", section_separators = "",
disabled_filetypes = {}, disabled_filetypes = {},
always_divide_middle = true, always_divide_middle = true,
refresh = {
statusline = 500,
},
}, },
sections = { sections = {
lualine_a = { lualine_a = {
@ -230,7 +232,7 @@ require("lualine").setup {
color = { gui = "italic,bold" }, color = { gui = "italic,bold" },
}, },
{ {
get_ahead_behind_info, get_git_ahead_behind_info,
color = { fg = "#E0C479" }, color = { fg = "#E0C479" },
}, },
{ {