Closed hoofcushion closed 21 hours ago
This is my solution:
local lazypath=vim.fs.joinpath(vim.fn.stdpath("data"),"lazy")
local bspath=vim.fs.joinpath(lazypath,"bootstrap.lua")
if not vim.uv.fs_stat(bspath) then
vim.fn.system({
"curl",
"-o",bspath,
"-s","https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua",
})
end
local Bootstrap=loadfile(bspath)()
-- Option for bootstrap still not implemented yet.
-- Bootstrap.setup({
-- lazypath=lazypath,
-- })
-- The update logic should be hold by lazy.nvim
---@return boolean
local function is_samefile(filename1,filename2)
local f1=vim.uv.fs_stat(filename1)
local f2=vim.uv.fs_stat(filename2)
return f1 and f2
and f1.size==f2.size
and f1.type==f2.type
and f1.mtime==f2.mtime
and f1.ino==f2.ino
end
vim.api.nvim_create_autocmd("User",{
pattern="LazyUpdate",
callback=function()
local new=vim.fs.joinpath(lazypath,"lazy.nvim","bootstrap.lua")
if not is_samefile(new,bspath) then
vim.uv.fs_unlink(bspath)
vim.uv.fs_copyfile(new,bspath)
end
end,
})
just install lazy.nvim as a plugin? You only need the bootstrap file if lazy isn't installed at all
I know that, I mean it's better that lazy have a way to update the bootstrap.lua.
Then whenever bootstrap.lua an update, you don't have to copy and paste. all the time.
imo this makes just no sense if the bootstrap would ever be updated it would still just be required to install lazy.nvim so if you have lazy.nvim installed you don't need to reload the bootstrap.lua file even if it would change
I don't understand what you said, if lazy.nvim update, then bootstrap also needs update.
I think you mean the lazy will never needs to change the way to bootstrap, but it was not guaranteed.
Whenever bootstrap.lua outdated, everyone needs to fetch manually again and again.
So the new bookstrap way is:
Then whenever neovim or lazy.nvim has a breaking change that deprecate the old bootstrap, lazy still can fix that by update it.
no bootstrap doesn't need to be updated even if it ever will be changed it is really highly unlikely that it will do something different than installing lazy.nvim so if you already installed lazy you just don't need to care
You're right in short term. And I was talking about a long term problem. That bootstrap must will be outdated.
Design a new way to update bootstrapb is a work that takes once, but works forever.
Maybe bootstrap won't be outdated in few months, but in a year or two, It's unlikely.
Did you check the docs?
Is your feature request related to a problem? Please describe.
lazy.nvim can not update the bootstrap.lua. It has to be fetch manually.
Describe the solution you'd like
Use a steady code to always do these thing:
Describe alternatives you've considered
pass
Additional context
No response