powerline for real

This commit is contained in:
Zacharias-Brohn
2025-12-16 22:42:56 +01:00
parent 13da88b31c
commit 80864a9d49
+21 -2
View File
@@ -278,6 +278,26 @@ local function update_statusline()
end end
end end
-- Debounce timer for statusline updates
local update_timer = nil
-- Schedule a statusline update with debouncing
local function schedule_update()
-- Cancel any pending update
if update_timer then
update_timer:stop()
update_timer:close()
update_timer = nil
end
-- Schedule a new update
update_timer = vim.loop.new_timer()
update_timer:start(5, 0, vim.schedule_wrap(function()
update_timer = nil
update_statusline()
end))
end
-- Saved laststatus value to restore on disable -- Saved laststatus value to restore on disable
M._saved_laststatus = nil M._saved_laststatus = nil
@@ -313,8 +333,7 @@ function M.enable_statusline()
vim.api.nvim_create_autocmd(events, { vim.api.nvim_create_autocmd(events, {
group = M._statusline_augroup, group = M._statusline_augroup,
callback = function() callback = function()
-- Defer slightly to batch rapid updates schedule_update()
vim.defer_fn(update_statusline, 10)
end, end,
}) })