From fd68de0bf024377e84876ad7373c1151c3bab9ec Mon Sep 17 00:00:00 2001 From: Warwick New Date: Mon, 25 Nov 2024 14:21:01 +0000 Subject: [PATCH] Improved lazy bootstrap --- lua/core/plugins.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua index 56713dc..8dd6347 100644 --- a/lua/core/plugins.lua +++ b/lua/core/plugins.lua @@ -1,13 +1,17 @@ +-- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath)