lazy.nvim/lua/init.lua

64 lines
1.4 KiB
Lua
Raw Normal View History

2024-06-18 22:17:53 +01: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 09:09:41 +01:00
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
2024-06-18 22:17:53 +01:00
end
local lazy_dev = vim.fn.expand("~/projects/lazy.nvim")
if vim.uv.fs_stat(lazy_dev) then
2024-06-23 09:09:41 +01:00
vim.opt.runtimepath:prepend(lazy_dev)
2024-06-18 22:17:53 +01:00
else
2024-06-23 09:09:41 +01:00
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
print("Bootstrapping lazy.nvim")
2024-06-23 09:11:42 +01:00
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
2024-06-23 09:09:41 +01:00
end
vim.opt.runtimepath:prepend(lazypath)
2024-06-18 22:17:53 +01:00
end
local function main()
2024-06-23 09:09:41 +01:00
print("Installing plugins")
require("lazy").setup({
spec = {
{ "folke/lazy.nvim" },
2024-06-23 09:09:41 +01:00
"folke/tokyonight.nvim",
},
root = root .. "/plugins",
})
2024-06-18 22:17:53 +01:00
2024-06-23 09:09:41 +01:00
if vim.o.filetype == "lazy" then
vim.cmd.close()
end
2024-06-18 22:17:53 +01:00
2024-06-23 09:09:41 +01: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-18 22:17:53 +01:00
2024-06-23 09:09:41 +01:00
vim.opt.rtp:append(".")
2024-06-18 22:17:53 +01:00
2024-06-23 09:09:41 +01:00
print("Building docs")
2024-06-18 22:17:53 +01:00
2024-06-23 09:09:41 +01:00
require("build").update()
2024-06-18 22:17:53 +01:00
2024-06-23 09:09:41 +01:00
print("Done!\n")
2024-06-18 22:17:53 +01:00
end
local Util = require("lazy.core.util")
Util.try(main, {
2024-06-23 09:09:41 +01:00
on_error = function(err)
print(err)
os.exit(1)
end,
2024-06-18 22:17:53 +01:00
})
os.exit(0)