mirror of
https://github.com/tiyn/tccs.nvim.git
synced 2026-02-16 12:54:49 +01:00
initial commit
This commit is contained in:
34
lua/tccs/config.lua
Normal file
34
lua/tccs/config.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
local config = {}
|
||||
|
||||
local defaults = {
|
||||
transparent = 0,
|
||||
italic_comments = 1,
|
||||
disable_nvimtree_bg = 0,
|
||||
color_overrides = {},
|
||||
group_overrides = {},
|
||||
}
|
||||
|
||||
config.opts = {}
|
||||
|
||||
---@param user_opts? table
|
||||
config.setup = function(user_opts)
|
||||
-- backwards compatibility: let users still set settings with global vars
|
||||
local global_settings_opts = vim.tbl_extend('force', defaults, {
|
||||
transparent = (vim.g.tccs_transparent == true or vim.g.tccs_transparent == 1),
|
||||
italic_comments = (vim.g.tccs_italic_comment == true or vim.g.tccs_italic_comment == 1),
|
||||
disable_nvimtree_bg = (vim.g.tccs_disable_nvim_tree_bg == true or vim.g.tccs_disable_nvim_tree_bg == 1),
|
||||
})
|
||||
|
||||
-- but override global vars settings with setup() settings
|
||||
config.opts = vim.tbl_extend('force', defaults, user_opts or {})
|
||||
|
||||
-- setting transparent to true removes the default background
|
||||
if config.opts.transparent then
|
||||
config.opts.color_overrides.vscBack = 'NONE'
|
||||
end
|
||||
end
|
||||
|
||||
-- initialize config
|
||||
config.setup()
|
||||
|
||||
return config
|
||||
Reference in New Issue
Block a user