2024-06-19 05:17:53 +08:00
|
|
|
-- DO NOT change the paths and don't remove the colorscheme
|
|
|
|
local root = vim.fn.fnamemodify("./.nvim", ":p")
|
|
|
|
|
|
|
|
-- set stdpaths to use .repro
|
|
|
|
for _, name in ipairs({ "config", "data", "state", "cache" }) do
|
2024-06-23 16:09:41 +08:00
|
|
|
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
|
2024-06-19 05:17:53 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local lazy_dev = vim.fn.expand("~/projects/lazy.nvim")
|
|
|
|
if vim.uv.fs_stat(lazy_dev) then
|
2024-06-23 16:09:41 +08:00
|
|
|
vim.opt.runtimepath:prepend(lazy_dev)
|
2024-06-19 05:17:53 +08:00
|
|
|
else
|
2024-06-23 16:09:41 +08:00
|
|
|
-- bootstrap lazy
|
|
|
|
local lazypath = root .. "/plugins/lazy.nvim"
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
|
|
print("Bootstrapping lazy.nvim")
|
2024-06-23 16:11:42 +08:00
|
|
|
vim.fn.system({
|
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
"--filter=blob:none",
|
|
|
|
-- FIXME: remove this when the new version is released
|
|
|
|
"--branch=pkg",
|
|
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
|
|
lazypath,
|
|
|
|
})
|
2024-06-23 16:09:41 +08:00
|
|
|
end
|
|
|
|
vim.opt.runtimepath:prepend(lazypath)
|
2024-06-19 05:17:53 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local function main()
|
2024-06-23 16:09:41 +08:00
|
|
|
print("Installing plugins")
|
|
|
|
require("lazy").setup({
|
|
|
|
spec = {
|
|
|
|
"folke/tokyonight.nvim",
|
|
|
|
},
|
|
|
|
root = root .. "/plugins",
|
|
|
|
})
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
if vim.o.filetype == "lazy" then
|
|
|
|
vim.cmd.close()
|
|
|
|
end
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
print("Updating plugins")
|
|
|
|
-- update plugins, wait for it to finish and don't show the output
|
|
|
|
require("lazy").update({ wait = true, show = false })
|
|
|
|
-- require("lazy.core.cache").reset()
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
vim.opt.rtp:append(".")
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
print("Building docs")
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
require("build").update()
|
2024-06-19 05:17:53 +08:00
|
|
|
|
2024-06-23 16:09:41 +08:00
|
|
|
print("Done!\n")
|
2024-06-19 05:17:53 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local Util = require("lazy.core.util")
|
|
|
|
Util.try(main, {
|
2024-06-23 16:09:41 +08:00
|
|
|
on_error = function(err)
|
|
|
|
print(err)
|
|
|
|
os.exit(1)
|
|
|
|
end,
|
2024-06-19 05:17:53 +08:00
|
|
|
})
|
|
|
|
os.exit(0)
|