From a82a7c878f5173068cc55cf88822c2fd9ea9f94a Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 9 Oct 2023 10:48:44 +0200 Subject: [PATCH] Nullify settings if empty string is passed --- lua/neogit/lib/state.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lua/neogit/lib/state.lua b/lua/neogit/lib/state.lua index 6c6d466b0..5b0e762f2 100644 --- a/lua/neogit/lib/state.lua +++ b/lua/neogit/lib/state.lua @@ -79,15 +79,21 @@ local function gen_key(key_table) end ---Set option and write to disk ----@param key table +---@param key string[] ---@param value any function M.set(key, value) if not M.enabled() then return end - if not vim.tbl_contains(config.values.ignored_settings, gen_key(key)) then - M.state[gen_key(key)] = value + local cache_key = gen_key(key) + if not vim.tbl_contains(config.values.ignored_settings, cache_key) then + if value == "" then + M.state[cache_key] = nil + else + M.state[cache_key] = value + end + M.write() end end