diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 25809b8..26e0945 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -96,13 +96,18 @@ local default_plugins = { vim.api.nvim_create_autocmd({ "BufRead" }, { group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }), callback = function() - vim.fn.system("git -C " .. '"' .. vim.fn.expand "%:p:h" .. '"' .. " rev-parse") - if vim.v.shell_error == 0 then - vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" - vim.schedule(function() - require("lazy").load { plugins = { "gitsigns.nvim" } } - end) - end + vim.fn.jobstart({"git", "-C", vim.loop.cwd(), "rev-parse"}, + { + on_exit = function(_, return_code) + if return_code == 0 then + vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" + vim.schedule(function() + require("lazy").load { plugins = { "gitsigns.nvim" } } + end) + end + end + } + ) end, }) end,