From eeb06a5a509c27b7f0877b513f2278f27cc98f67 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 17 Dec 2022 12:59:31 +0100 Subject: [PATCH] feat(loader): added error handler to sourcing of runtime files --- lua/lazy/core/loader.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 119b95dc..c510d698 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -171,7 +171,9 @@ function M.source_runtime(...) name = name:sub(1, -5) if t == "file" and (ext == "lua" or ext == "vim") and not M.disabled_rtp_plugins[name] then Util.track({ runtime = path }) - vim.cmd("silent source " .. path) + Util.try(function() + vim.cmd("silent source " .. path) + end, "Failed to source `" .. path .. "`") Util.track() end end)