From 3ce5eaca0b634a4ee6fe76e73153653d1628a91d Mon Sep 17 00:00:00 2001 From: bhagwan Date: Mon, 13 Jun 2022 09:52:52 -0700 Subject: [PATCH] feat(icons): option to globally control file|git icons (#188) --- lua/fzf-lua/config.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/fzf-lua/config.lua b/lua/fzf-lua/config.lua index 9cc87d2..80c6029 100644 --- a/lua/fzf-lua/config.lua +++ b/lua/fzf-lua/config.lua @@ -744,6 +744,20 @@ function M.normalize_opts(opts, defaults) opts.global_resume = get_opt('global_resume', opts, M.globals) opts.global_resume_query = get_opt('global_resume_query', opts, M.globals) + -- global option overrides, if exists, these options will + -- be used in a "LOGICAL AND" against the local option (#188) + -- e.g.: + -- git_icons = TRUE + -- global_git_icons = FALSE + -- the resulting 'git_icons' would be: + -- git_icons = TRUE && FALSE (==FALSE) + for _, o in ipairs({ 'file_icons', 'git_icons', 'color_icons' }) do + local g_opt = get_opt("global_" .. o, opts, M.globals) + if g_opt ~= nil then + opts[o] = opts[o] and g_opt + end + end + -- backward compatibility, rhs overrides lhs -- (rhs being the "old" option) local backward_compat = {