-
-
Save livexia/77dbdeafc7956c142ca9946baadcf461 to your computer and use it in GitHub Desktop.
Revisions
-
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,6 @@ end -- @USAGE: :lua safe_reload('foo') function _G.safe_reload(module) package.loaded[module] = nil return safe_require(module) end -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ _G.safe_require = function(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) end, 1000) return nil -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ _G.safe_require = function(module_name) vim.notify('Could not load module: ' .. module_name, 'error') end) end, 1000) return nil else return module end -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ -- @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 -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ _G.safe_require = function(module_name) end end -- @USAGE: :lua safe_reload('foo') function _G.safe_reload(module) module.loaded[module] = nil return safe_require(module) -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,20 @@ -- @USAGE: local foo = safe_require('foo') _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') end) end, 1000) return else return module end end -- @USAGE: :lua reload('foo') function _G.safe_reload(module) module.loaded[module] = nil return safe_require(module) end -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ _G.safe_require = function(package_name) end -- @USAGE: :lua reload('foo') function _G.safe_reload(package) package.loaded[package] = nil return safe_require(package) end -
beauwilliams revised this gist
Sep 17, 2022 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ -- @USAGE: local foo = safe_require('foo') _G.safe_require = function(package_name) local package_exists, package = pcall(require, package_name) if not package_exists then @@ -12,3 +12,9 @@ _G.safe_require = function(package_name) return package end end -- @USAGE: :lua reload('foo') function _G.reload(package) package.loaded[package] = nil return safe_require(package) end -
beauwilliams created this gist
Sep 17, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ --@USAGE: local foo = safe_require('foo') _G.safe_require = function(package_name) local package_exists, package = pcall(require, package_name) if not package_exists then vim.defer_fn(function() vim.schedule(function() vim.notify('Could not load package: ' .. package_name, 'error') end) end, 1000) return else return package end end