diff --git a/README.md b/README.md index e063ed3..284d469 100644 --- a/README.md +++ b/README.md @@ -336,6 +336,20 @@ catppuccin.before_loading = function () end ``` +#### Autocmd + +Instead of `after_loading` hook, you can use autocmd event like this: + +```lua +vim.api.nvim_create_autocmd("User", { + pattern = "CatppuccinLoaded", + callback = function() + local colors = require("catppuccin.api.colors").get_colors() + -- do something with colors + end +}) +``` + ## 💝 Thanks to - [Pocco81](https://github.com/Pocco81) diff --git a/lua/catppuccin/main.lua b/lua/catppuccin/main.lua index 16fc21c..0f96ba7 100644 --- a/lua/catppuccin/main.lua +++ b/lua/catppuccin/main.lua @@ -21,6 +21,8 @@ local function load() if catppuccin.after_loading ~= nil then catppuccin.after_loading() end + + vim.api.nvim_exec_autocmds("User", { pattern = "CatppuccinLoaded" }) end function M.main(option)