mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-25 14:01:03 +00:00
chore: merge new config
This commit is contained in:
parent
66118ec8a3
commit
91879d99d9
1 changed files with 36 additions and 11 deletions
|
|
@ -1,19 +1,44 @@
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
vim.api.nvim_echo({
|
vim.api.nvim_echo({
|
||||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
{ out, "WarningMsg" },
|
{ out, "WarningMsg" },
|
||||||
{ "\nPress any key to exit..." },
|
{ "\nPress any key to exit..." },
|
||||||
}, true, {})
|
}, true, {})
|
||||||
vim.fn.getchar()
|
vim.fn.getchar()
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
local function generate_import_specs()
|
||||||
|
local specs = {}
|
||||||
|
|
||||||
|
local function add_specs_from_dir(path)
|
||||||
|
local uv = vim.loop
|
||||||
|
local stats = uv.fs_readdir(uv.fs_opendir(vim.fn.stdpath("config") .. "/" .. "lua" .. "/" .. path, nil, 1000))
|
||||||
|
if not stats then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, stat in ipairs(stats) do
|
||||||
|
-- print(stat.name)
|
||||||
|
if stat.type == "directory" then
|
||||||
|
local new_import_path = path .. "/" .. stat.name
|
||||||
|
table.insert(specs, { import = new_import_path:gsub("/", ".") })
|
||||||
|
add_specs_from_dir(new_import_path)
|
||||||
|
elseif stat.name == "init.lua" then
|
||||||
|
table.remove(specs) -- removes last element
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_specs_from_dir("plugins")
|
||||||
|
return specs
|
||||||
|
end
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = {
|
spec = {
|
||||||
-- add LazyVim and import its plugins
|
-- add LazyVim and import its plugins
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue