@@ -248,16 +248,29 @@ function M.normalize_opts(opts, globals, __resume_key)
248
248
-- merge with provider defaults from globals (defaults + setup options)
249
249
opts = vim .tbl_deep_extend (" keep" , opts , utils .tbl_deep_clone (globals ))
250
250
251
- -- Merge required tables from globals
251
+ -- Merge values from globals
252
252
for _ , k in ipairs ({
253
253
" winopts" , " keymap" , " fzf_opts" , " fzf_colors" , " fzf_tmux_opts" , " hls"
254
254
}) do
255
- opts [k ] = vim .tbl_deep_extend (" keep" ,
255
+ local setup_val = M .globals [k ]
256
+ if type (setup_val ) == " table" then
256
257
-- must clone or map will be saved as reference
257
258
-- and then overwritten if found in 'backward_compat'
258
- type (opts [k ]) == " function" and opts [k ]() or opts [k ] or {},
259
- type (M .globals [k ]) == " function" and M .globals [k ](opts ) or
260
- type (M .globals [k ]) == " table" and utils .tbl_deep_clone (M .globals [k ]) or {})
259
+ setup_val = utils .tbl_deep_clone (setup_val )
260
+ elseif type (setup_val ) == " function" then
261
+ setup_val = setup_val (opts )
262
+ end
263
+ if opts [k ] == nil then
264
+ opts [k ] = setup_val
265
+ else
266
+ if type (opts [k ]) == " function" then
267
+ opts [k ] = opts [k ](opts )
268
+ end
269
+ if type (opts [k ]) == " table" then
270
+ opts [k ] = vim .tbl_deep_extend (" keep" ,
271
+ opts [k ], type (setup_val ) == " table" and setup_val or {})
272
+ end
273
+ end
261
274
end
262
275
263
276
-- backward compat: no-value flags should be set to `true`, in the past these
0 commit comments