From 184d92919e65ac3f79ac95d9724e958a921dca05 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Thu, 14 Jul 2022 00:04:29 +0700 Subject: [PATCH] chore(command): Update readme --- README.md | 31 +++++++++++++++++++++++++++++++ lua/catppuccin/main.lua | 8 ++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4ac9355..764d128 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,11 @@ There are already some sane defaults that you may like, however you can change t dim_inactive = false, transparent_background = false, term_colors = false, +compile = { + enable = false, + path = vim.fn.stdpath "cache" .. "/catppuccin", + suffix = "_compiled" +}, styles = { comments = { "italic" }, conditionals = { "italic" }, @@ -287,6 +292,32 @@ integration = { } ``` +# Compiling + +Catppuccin is a highly customizable and configurable colorscheme. This does however come at the cost of complexity and execution time. + +Catppuccin can pre compute the results of your configuration and store the results in a compiled lua file. We use these precached values to set it's highlights. + +To enable compile enables it in setup function: + +```lua +compile = { + enable = true, + path = vim.fn.stdpath "cache" .. "/catppuccin", + suffix = "_compiled" +}, +``` +By default catppuccin writes the compiled results into the system's cache directory. + +Catppuccin provides these commands to work with the catppuccin compiler. + +```vim +:CatppuccinCompile # Create/update the compile files +:CatppuccinClean # Delete compiled files +``` + +Acknowledge: [nightfox.nvim#compile](https://github.com/EdenEast/nightfox.nvim#compile) + ### Extra #### API diff --git a/lua/catppuccin/main.lua b/lua/catppuccin/main.lua index b9d532d..55d7cc5 100644 --- a/lua/catppuccin/main.lua +++ b/lua/catppuccin/main.lua @@ -5,15 +5,19 @@ local flavours = {"latte", "frappe", "macchiato", "mocha"} local command = vim.api.nvim_create_user_command command("Catppuccin", function(inp) + if not vim.tbl_contains(flavours, inp.args) then + local echo = require("catppuccin.utils.echo") + echo("Invalid flavour", "info") + return + end vim.g.catppuccin_flavour = inp.args vim.cmd "colorscheme catppuccin" end, { nargs = 1, complete = function(line) - local builtin_list = flavours return vim.tbl_filter(function(val) return vim.startswith(val, line) - end, builtin_list) + end, flavours) end })