From e60e400c411519f29e203185ddda121d4ec8ef57 Mon Sep 17 00:00:00 2001 From: RAV64 <73443709+RAV64@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:37:34 +0200 Subject: [PATCH] feat: add ability to toggle default integrations (#687) * feat: no_defaults option to disable all defaults * feat no_defaults update readme * docs: auto generate vimdoc * `no_defaults` -> `default_integrations` * docs: auto generate vimdoc * fix stylua * nil -> {} --------- Co-authored-by: RAV64 Co-authored-by: mrtnvgr Co-authored-by: mrtnvgr Co-authored-by: mrtnvgr --- README.md | 9 +++++++++ doc/catppuccin.txt | 10 ++++++++++ lua/catppuccin/init.lua | 4 ++++ lua/catppuccin/types.lua | 2 ++ 4 files changed, 25 insertions(+) diff --git a/README.md b/README.md index abbf6b64..7bb355f7 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ require("catppuccin").setup({ }, color_overrides = {}, custom_highlights = {}, + default_integrations = true, integrations = { cmp = true, gitsigns = true, @@ -253,6 +254,14 @@ require("catppuccin").setup({ }) ``` +Some integrations are enabled by default, you can control this behaviour with `default_integrations` option. + +```lua +require("catppuccin").setup({ + default_integrations = false, +}) +``` + Below is a list of supported plugins and their corresponding integration module. > [!Important] diff --git a/doc/catppuccin.txt b/doc/catppuccin.txt index 56303fcf..37d00518 100644 --- a/doc/catppuccin.txt +++ b/doc/catppuccin.txt @@ -104,6 +104,7 @@ options and settings. }, color_overrides = {}, custom_highlights = {}, + default_integrations = true, integrations = { cmp = true, gitsigns = true, @@ -246,6 +247,15 @@ example: }) < +Some integrations are enabled by default, you can control this behaviour with +`default_integrations` option. + +>lua + require("catppuccin").setup({ + default_integrations = false, + }) +< + Below is a list of supported plugins and their corresponding integration module. diff --git a/lua/catppuccin/init.lua b/lua/catppuccin/init.lua index 85cdd177..d6460317 100644 --- a/lua/catppuccin/init.lua +++ b/lua/catppuccin/init.lua @@ -35,6 +35,7 @@ local M = { types = {}, operators = {}, }, + default_integrations = true, integrations = { alpha = true, cmp = true, @@ -165,6 +166,9 @@ function M.setup(user_conf) did_setup = true -- Parsing user config user_conf = user_conf or {} + + if user_conf.default_integrations == false then M.default_options.integrations = {} end + M.options = vim.tbl_deep_extend("keep", user_conf, M.default_options) M.options.highlight_overrides.all = user_conf.custom_highlights or M.options.highlight_overrides.all diff --git a/lua/catppuccin/types.lua b/lua/catppuccin/types.lua index b4b8b70e..799e120b 100644 --- a/lua/catppuccin/types.lua +++ b/lua/catppuccin/types.lua @@ -31,6 +31,8 @@ ---@field no_underline boolean? -- Handles the style of general hl groups (see `:h highlight-groups`). ---@field styles CtpStyles? +-- Should default integrations be used. +---@field default_integrations boolean? -- Toggle integrations. Integrations allow Catppuccin to set the theme of various plugins. ---@field integrations CtpIntegrations? -- Catppuccin colors can be overwritten here.