Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to enable/disable all integrations by default #552

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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