From c2a1298ac0c520e6e898758293c3aaff8c0b4b53 Mon Sep 17 00:00:00 2001 From: siduck Date: Sat, 22 Jan 2022 18:33:05 +0530 Subject: [PATCH] fix error handling of custom/init.lua (#739) --- init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 3df86c6..f1c66de 100644 --- a/init.lua +++ b/init.lua @@ -14,8 +14,12 @@ end -- non plugin mappings require("core.mappings").misc() --- try to call custom init -local ok, err = pcall(require, "custom") -if not ok then - vim.notify("Error loading custom/init.lua\n\n" .. err) +-- check if custom init.lua file exists +if vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/init.lua") == 1 then + -- try to call custom init, if not successful, show error + local ok, err = pcall(require, "custom") + if not ok then + vim.notify("Error loading custom/init.lua\n\n" .. err) + end + return end