Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lua/packer/plugin_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,23 @@ plugin_utils.load_plugin = function(plugin)
vim.o.runtimepath = vim.o.runtimepath .. ',' .. plugin.install_path
for _, pat in ipairs {
table.concat({ 'plugin', '**/*.vim' }, util.get_separator()),
table.concat({ 'plugin', '**/*.lua' }, util.get_separator()),
table.concat({ 'after', 'plugin', '**/*.vim' }, util.get_separator()),
table.concat({ 'after', 'plugin', '**/*.lua' }, util.get_separator()),
} do
local cmd = vim.endswith(pat, 'lua') and 'luafile' or 'source'
local path = util.join_paths(plugin.install_path, pat)
local glob_ok, files = pcall(vim.fn.glob, path, false, true)
if not glob_ok then
if string.find(files, 'E77') then
vim.cmd('silent exe "source ' .. path .. '"')
vim.cmd('silent exe "' .. cmd .. ' ' .. path .. '"')
else
error(files)
end
elseif #files > 0 then
for _, file in ipairs(files) do
file = file:gsub('\\', '/')
vim.cmd('silent exe "source ' .. file .. '"')
vim.cmd('silent exe "' .. cmd .. ' ' .. file .. '"')
end
end
end
Expand Down