This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @USAGE: | |
-- local foo = safe_require('foo') | |
-- if not foo then return end | |
_G.safe_require = function(module_name) | |
local package_exists, module = pcall(require, module_name) | |
if not package_exists then | |
vim.defer_fn(function() | |
vim.schedule(function() | |
vim.notify('Could not load module: ' .. module_name, 'error', { title = 'Module Not Found' }) | |
end) |