Skip to content

Commit

Permalink
feat: add ability to enable/disable all integrations by default (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter authored Jul 26, 2023
1 parent 6425df1 commit 737f60a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ require("catppuccin").setup({
},
color_overrides = {},
custom_highlights = {},
integration_default = nil, -- set to true/false to enable/disable integrations by default
integrations = {
cmp = true,
gitsigns = true,
Expand Down
1 change: 1 addition & 0 deletions doc/catppuccin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ options and settings.
},
color_overrides = {},
custom_highlights = {},
integration_default = nil, -- set to true/false to enable/disable integrations by default
integrations = {
cmp = true,
gitsigns = true,
Expand Down
13 changes: 12 additions & 1 deletion lua/catppuccin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,18 @@ function M.setup(user_conf)
did_setup = true
-- Parsing user config
user_conf = user_conf or {}
M.options = vim.tbl_deep_extend("keep", user_conf, M.default_options)
local options = M.default_options
if user_conf.integration_default ~= nil then
options = vim.deepcopy(M.default_options)
for key, _ in pairs(options.integrations) do
if type(options.integrations[key]) == "table" then
options.integrations[key].enabled = user_conf.integration_default
else
options.integrations[key] = user_conf.integration_default
end
end
end
M.options = vim.tbl_deep_extend("keep", user_conf, options)
M.options.highlight_overrides.all = user_conf.custom_highlights or M.options.highlight_overrides.all

-- Get cached hash
Expand Down
3 changes: 3 additions & 0 deletions lua/catppuccin/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
---@field no_underline boolean
-- Handles the style of general hl groups (see `:h highlight-groups`).
---@field styles CtpStyles
-- Control default of integrations. `true` enables all integrations and `false` disables all integrations
-- If `nil`, use the defaults provided by Catppuccin
---@field integration_default boolean?
-- Toggle integrations. Integrations allow Catppuccin to set the theme of various plugins.
---@field integrations CtpIntegrations
-- Catppuccin colors can be overwritten here.
Expand Down

0 comments on commit 737f60a

Please sign in to comment.