-- Auto generated by rsplug
local pkgid2scripts = {<% for (id, script_set) in pkgid2scripts {%>['<%=id%>']={<% for (script_type, module_ids) in script_set {%>['<%=script_type%>']={<% for module_id in module_ids {%>'<%=module_id%>',<%}%>},<%}%>},<%}%>}
local startup_plugins = {<% for id in startup_plugins {%>'<%=id%>',<%}%>}
local loaded = {}
return {
loaded = loaded,
---@param id string
---@param startup boolean|nil
packadd = function(id, startup)
if loaded[id] then return end
loaded[id] = true
local setup_scripts = pkgid2scripts[id] or {};
for _, before in ipairs(setup_scripts.lua_before or {}) do
require(before)
end
vim.cmd((startup and 'packadd! ' or 'packadd ') .. vim.fn.fnameescape(id))
for _, after in ipairs(setup_scripts.lua_after or {}) do
require(after)
end
end,
startup = function()
for _, id in ipairs(startup_plugins) do
require('_rsplug').packadd(id, true)
end
end,
---@param ft string
get_ft_runtime_file = function(ft)
local files = vim.api.nvim_get_runtime_file('ftplugin/' .. ft .. '.{vim,lua}', true)
files = vim.list_extend(files, vim.api.nvim_get_runtime_file('ftplugin/' .. ft .. '_*.{vim,lua}', true))
files = vim.list_extend(files, vim.api.nvim_get_runtime_file('ftplugin/' .. ft .. '/*.{vim,lua}', true))
return files
end,
---@param current vim.api.keyset.get_autocmds.ret
---@param old vim.api.keyset.get_autocmds.ret
get_new_autocmds = function(current, old)
---@param item vim.api.keyset.get_autocmds.ret
return vim.tbl_filter(function(item)
for _, o in ipairs(old) do
if item.id and item.id == o.id then
return false
end
if item.group and item.group == o.group then
return false
end
if item.callback and item.callback == o.callback then
return false
end
local is_same = true
for _, property in ipairs { 'buffer', 'buflocal', 'command', 'desc', 'once', 'pattern' } do
if item[property] ~= o[property] then
is_same = false
break
end
end
if is_same then
return false
end
end
return true
end, current)
end,
}