build: better minit

This commit is contained in:
Folke Lemaitre 2024-07-04 17:53:45 +02:00
parent 923e1aa7a4
commit a17ad27435
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
4 changed files with 67 additions and 26 deletions

View file

@ -13,6 +13,10 @@ function M.setup()
end
end
if vim.env.LAZY_PATH and not vim.uv.fs_stat(vim.env.LAZY_PATH) then
vim.env.LAZY_PATH = nil
end
local lazypath = vim.env.LAZY_PATH or vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.env.LAZY_PATH and not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.api.nvim_echo({
@ -26,19 +30,12 @@ function M.setup()
pcall(vim.fn.system, { "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if not ok or vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{
"Failed to clone lazy.nvim\n",
"ErrorMsg",
},
{
vim.trim(out or ""),
"WarningMsg",
},
{ "\nPress any key to exit", "MoreMsg" },
{ "Failed to clone lazy.nvim\n", "ErrorMsg" },
{ vim.trim(out or ""), "WarningMsg" },
{ "\nPress any key to exit...", "MoreMsg" },
}, true, {})
vim.fn.getchar()
vim.cmd([[quit]])
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)