summaryrefslogtreecommitdiff
path: root/lua/lvim/bootstrap.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-10-04 19:23:52 +0200
committerGitHub <[email protected]>2022-10-04 13:23:52 -0400
commite5bcf01c759e7c833d8a5f1fcf665b6ea32a7c16 (patch)
tree51b68c8face9faa2a41fcc8103b6296213557d4b /lua/lvim/bootstrap.lua
parent560ee4d7cf4038a22a5556d79ad92cd226a792dc (diff)
refactor: more deliberate reload (#3133)
Diffstat (limited to 'lua/lvim/bootstrap.lua')
-rw-r--r--lua/lvim/bootstrap.lua18
1 files changed, 6 insertions, 12 deletions
diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua
index e0b781d7..b803cfa6 100644
--- a/lua/lvim/bootstrap.lua
+++ b/lua/lvim/bootstrap.lua
@@ -19,15 +19,9 @@ function _G.join_paths(...)
return result
end
----Require a module in protected mode without relying on its cached value
----@param module string
----@return any
-function _G.require_clean(module)
- package.loaded[module] = nil
- _G[module] = nil
- local _, requested = pcall(require, module)
- return requested
-end
+_G.require_clean = require("lvim.utils.modules").require_clean
+_G.require_safe = require("lvim.utils.modules").require_safe
+_G.reload = require("lvim.utils.modules").reload
---Get the full path to `$LUNARVIM_RUNTIME_DIR`
---@return string
@@ -121,10 +115,10 @@ end
---Update LunarVim
---pulls the latest changes from github and, resets the startup cache
function M:update()
- require_clean("lvim.utils.hooks").run_pre_update()
- local ret = require_clean("lvim.utils.git").update_base_lvim()
+ reload("lvim.utils.hooks").run_pre_update()
+ local ret = reload("lvim.utils.git").update_base_lvim()
if ret then
- require_clean("lvim.utils.hooks").run_post_update()
+ reload("lvim.utils.hooks").run_post_update()
end
end