mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 11:24:14 +00:00
fix: catch errors setting up rtp when plugin not installed
I was getting E5108 .ometimes when a plugin that loads on `start` wasn't installed. That interrupted Lazy's load, preventing me from then using it to install the missing plugin. On Windows it happened every time, on Linux it was about every 2nd time.
This commit is contained in:
parent
96584866b9
commit
7812d81cd9
1 changed files with 12 additions and 1 deletions
|
@ -472,7 +472,18 @@ function M.add_to_rtp(plugin)
|
|||
table.insert(rtp, idx_after or (#rtp + 1), after)
|
||||
end
|
||||
|
||||
local ok, result = pcall(function()
|
||||
vim.opt.rtp = rtp
|
||||
end)
|
||||
if not ok then
|
||||
-- Often gets E5108 when plugins aren't installed, but it's
|
||||
-- inconsistent.
|
||||
vim.notify(
|
||||
"Unable to add rtp for " .. plugin.name .. ". Error message: " .. result,
|
||||
vim.log.levels.WARN,
|
||||
{ title = "lazy.nvim" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function M.source(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue