diff --git a/lua/catppuccin/core/integrations/lightspeed.lua b/lua/catppuccin/core/integrations/lightspeed.lua index 5baf2ed..4b90a9e 100644 --- a/lua/catppuccin/core/integrations/lightspeed.lua +++ b/lua/catppuccin/core/integrations/lightspeed.lua @@ -13,19 +13,14 @@ end function M.get(cp) if not get_prepared() then - local catppuccin = require("catppuccin") - if catppuccin.after_loading ~= nil then - local callback = catppuccin.after_loading - catppuccin.after_loading = function () - callback() - require'lightspeed'.init_highlight() + set_prepared(vim.api.nvim_create_autocmd("User", { + pattern = "CatppuccinLoaded", + callback = function () + if pcall(require, "lightspeed") then + require("lightspeed").init_highlight() + end end - else - catppuccin.after_loading = function () - require'lightspeed'.init_highlight() - end - end - set_prepared(true) + })) end return {