31 lines
816 B
Lua
31 lines
816 B
Lua
local config_module_dir = 'packs/'
|
|
local packs_file = 'packs.lua'
|
|
|
|
vim.pack.add(require(packs_file))
|
|
|
|
local config_module_path = vim.fs.joinpath(vim.fn.stdpath('config'), 'lua/' .. config_module_dir)
|
|
for name, _ in vim.fs.dir(config_module_path) do
|
|
if name == 'lua.lua' then
|
|
goto continue
|
|
end
|
|
local ok, config = pcall(require,config_module_dir .. name:gsub('%.lua',''))
|
|
if ok then
|
|
if config[1] ~= nil then
|
|
config[1]()
|
|
end
|
|
if config['config'] ~= nil then
|
|
config['config']()
|
|
end
|
|
end
|
|
::continue::
|
|
end
|
|
|
|
vim.api.nvim_create_user_command('UpdatePacks', function ()
|
|
local delete_candidates = vim.iter(vim.pack.get())
|
|
:filter(function(x) return not x.active end)
|
|
:map(function(x) return x.spec.name end)
|
|
:totable()
|
|
|
|
vim.pack.del(delete_candidates)
|
|
vim.pack.update()
|
|
end, {})
|