summaryrefslogtreecommitdiff
path: root/lua/lvim/plugin-loader.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-11-01 15:22:20 +0100
committerGitHub <[email protected]>2022-11-01 10:22:20 -0400
commit325bf72f935aa2caf25cb644f79dc7a3ea2c1168 (patch)
tree0a5c04044f0e42b7701ef66b5c7320f4d53db982 /lua/lvim/plugin-loader.lua
parent978ff7c24de968d5f2f956b72a196773ae80b903 (diff)
refactor(hooks): use colorscheme event after reload (#3375)
Diffstat (limited to 'lua/lvim/plugin-loader.lua')
-rw-r--r--lua/lvim/plugin-loader.lua22
1 files changed, 18 insertions, 4 deletions
diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua
index 1f574bba..b786bfa7 100644
--- a/lua/lvim/plugin-loader.lua
+++ b/lua/lvim/plugin-loader.lua
@@ -69,6 +69,9 @@ local function pcall_packer_command(cmd, kwargs)
end
function plugin_loader.cache_clear()
+ if not utils.is_file(compile_path) then
+ return
+ end
if vim.fn.delete(compile_path) == 0 then
Log:debug "deleted packer_compiled.lua"
end
@@ -76,10 +79,17 @@ end
function plugin_loader.recompile()
plugin_loader.cache_clear()
+ vim.cmd [[LuaCacheClear]]
pcall_packer_command "compile"
- if utils.is_file(compile_path) then
- Log:debug "generated packer_compiled.lua"
- end
+ vim.api.nvim_create_autocmd("User", {
+ pattern = "PackerCompileDone",
+ once = true,
+ callback = function()
+ if utils.is_file(compile_path) then
+ Log:debug "generated packer_compiled.lua"
+ end
+ end,
+ })
end
function plugin_loader.reload(configurations)
@@ -150,7 +160,11 @@ function plugin_loader.sync_core_plugins()
require("lvim.plugin-loader").load_snapshot(default_snapshot)
end,
})
- pcall_packer_command "sync"
+
+ plugin_loader.cache_clear()
+ local core_plugins = plugin_loader.get_core_plugins()
+ Log:trace(string.format("Syncing core plugins: [%q]", table.concat(core_plugins, ", ")))
+ pcall_packer_command("sync", core_plugins)
end
function plugin_loader.ensure_plugins()