From 40801defb44995b80457e64753a28f3cb000cbdf Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sun, 17 Jul 2022 16:21:01 +0700 Subject: [PATCH] chore(readme): Update auto-compile examples --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7010611..cb5c27b 100644 --- a/README.md +++ b/README.md @@ -356,26 +356,29 @@ Plug 'catppuccin/nvim', {'as': 'catppuccin', 'do': 'CatppuccinCompile'} Packer.nvim ```lua --- Create an autocmd `User PackerCompileDone` to update it every time packer is compiled -autocmd("User", { +-- If you want catppuccin live reload after :PackerCompile +require("packer").init { + auto_reload_compiled = true, +} +``` + +```lua +-- Create an autocmd User PackerCompileDone to update it every time packer is compiled +vim.api.nvim_create_autocmd("User", { pattern = "PackerCompileDone", callback = function() vim.cmd "CatppuccinCompile" - vim.cmd "colorscheme catppuccin" + vim.defer_fn(function() + vim.cmd "colorscheme catppuccin" + end, 50) -- Debounced for live reloading end, }) ``` -```lua --- Enable auto reload compiled in packer setting -require("packer").init { - auto_reload_compiled = true, -} -``` Vim-plug ```bash -# Auto compile on save if catppuccin config is in `init.vim` +# Auto compile on save if catppuccin config is written inside init.vim autocmd BufWritePost init.vim :CatppuccinCompile ```