use default config outside of setup function

ref #63
This commit is contained in:
mvllow 2022-02-06 21:17:35 -06:00
commit 9f4356a0da

View file

@ -41,14 +41,7 @@ local M = {}
---@field h6 string ---@field h6 string
---@type RosePineConfig ---@type RosePineConfig
local config = {} local config = {
---@param opts RosePineConfig
function M.setup(opts)
opts = opts or {}
vim.g.rose_pine_variant = opts.variant or 'main'
local default_config = {
variant = 'main', variant = 'main',
bold_vert_split = false, bold_vert_split = false,
dim_nc_background = false, dim_nc_background = false,
@ -86,7 +79,12 @@ function M.setup(opts)
h6 = 'foam', h6 = 'foam',
}, },
}, },
} }
---@param opts RosePineConfig
function M.setup(opts)
opts = opts or {}
vim.g.rose_pine_variant = opts.variant or 'main'
if opts.groups and type(opts.groups.headings) == 'string' then if opts.groups and type(opts.groups.headings) == 'string' then
opts.groups.headings = { opts.groups.headings = {
@ -100,7 +98,7 @@ function M.setup(opts)
end end
config.user_variant = opts.variant or nil config.user_variant = opts.variant or nil
config = vim.tbl_deep_extend('force', default_config, opts) config = vim.tbl_deep_extend('force', config, opts)
end end
function M.colorscheme() function M.colorscheme()