From 3f4edd589ad57e2fc1dc7f3975316db697103c55 Mon Sep 17 00:00:00 2001 From: pfych Date: Fri, 21 Mar 2025 14:59:27 +1100 Subject: [PATCH] Use vim.schedule() --- .config/nvim/lua/plugins/lazy.lua | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index f7a2af0..61991e6 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -1,31 +1,33 @@ vim.api.nvim_create_autocmd("User", { pattern = "LazyUpdate", callback = function() - local home = os.getenv("HOME") or "~/" + vim.schedule(function() + local home = os.getenv("HOME") or "~/" - local cmd = { - "yadm", - "-C", - string.format("%s", home), - "commit", - ".config/nvim/lazy-lock.json", - "-m", - "Update lazy-lock.json" - } + local cmd = { + "yadm", + "-C", + string.format("%s", home), + "commit", + ".config/nvim/lazy-lock.json", + "-m", + "Update lazy-lock.json" + } - local success, process = pcall(function() - return vim.system(cmd):wait() - end) + local success, process = pcall(function() + return vim.system(cmd):wait() + end) - if process and process.code == 0 then - vim.notify("Committed lazy-lock") - else - if not success then - vim.notify("Failed to run command") + if process and process.code == 0 then + vim.notify("Committed lazy-lock") else - vim.notify("Git ran, but nothing committed") + if not success then + vim.notify("Failed to run command") + else + vim.notify("Git ran, but nothing committed") + end end - end + end) end })