Make sure lazy setup is using the locked commit
This commit is contained in:
parent
c0039f4a4c
commit
c18ee3cd1b
22
init.lua
22
init.lua
@ -1,23 +1,3 @@
|
|||||||
require("valeth.options")
|
require("valeth.options")
|
||||||
require("valeth.keymaps")
|
require("valeth.keymaps")
|
||||||
|
require("valeth.lazy")
|
||||||
local function lazy_setup()
|
|
||||||
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,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
require("lazy").setup("valeth.plugins")
|
|
||||||
end
|
|
||||||
|
|
||||||
lazy_setup()
|
|
||||||
|
53
lua/valeth/lazy.lua
Normal file
53
lua/valeth/lazy.lua
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
local uv = vim.loop
|
||||||
|
|
||||||
|
|
||||||
|
local function locked_commit()
|
||||||
|
local lockfile_path = vim.fn.stdpath("config") .. "/lazy-lock.json"
|
||||||
|
local lockfile = io.open(lockfile_path, "r")
|
||||||
|
|
||||||
|
if not lockfile then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local text = lockfile:read("*all")
|
||||||
|
lockfile:close()
|
||||||
|
local json = vim.json.decode(text)
|
||||||
|
|
||||||
|
return json["lazy.nvim"]["commit"]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function checkout_commit(path)
|
||||||
|
local commit = locked_commit()
|
||||||
|
|
||||||
|
if not commit then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
uv.spawn("git", {
|
||||||
|
args = { "checkout", commit },
|
||||||
|
cwd = path
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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",
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
|
||||||
|
checkout_commit(lazypath)
|
||||||
|
vim.wait(1)
|
||||||
|
vim.notify("Installed lazy.nvim")
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup("valeth.plugins")
|
Loading…
Reference in New Issue
Block a user