From 8797c0df3f46fd0156de50f4aad7efdce2ac07c3 Mon Sep 17 00:00:00 2001 From: HyBer <59885141+BBboy01@users.noreply.github.com> Date: Tue, 22 Jul 2025 19:16:27 +0800 Subject: [PATCH] fix(window): set correct window size for lazygit to render (#158) since `open_floating_window` use async way `vim.defer_fn` to create window, `lazygit` executed with a sync way of `vim.fn.jobstart` in `exec_lazygit_command`, it can't get the floating window size at the banging before: https://github.com/user-attachments/assets/771b4099-c398-42b4-a80f-367f2d1305e7 after: https://github.com/user-attachments/assets/12cb7381-625c-49c3-bf61-0e385ce79c76 --- lua/lazygit.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazygit.lua b/lua/lazygit.lua index 64450f4..c1a6569 100644 --- a/lua/lazygit.lua +++ b/lua/lazygit.lua @@ -59,7 +59,9 @@ local function exec_lazygit_command(cmd) command = cmd end - vim.fn.jobstart(command, { term = true, on_exit = on_exit }) + vim.schedule(function() + vim.fn.jobstart(command, { term = true, on_exit = on_exit }) + end) end vim.cmd("startinsert") end