diff --git a/lua/gitblame/config.lua b/lua/gitblame/config.lua index 848d8c6..3a4e1b1 100644 --- a/lua/gitblame/config.lua +++ b/lua/gitblame/config.lua @@ -27,13 +27,16 @@ M.default_opts = { ---@param opts SetupOptions? M.setup = function(opts) - opts = opts or {} - opts = vim.tbl_deep_extend("force", M.default_opts, opts) + local opts = opts or {} - for key, value in pairs(opts) do - if vim.g["gitblame_" .. key] == nil or M.default_opts[key] ~= value then - vim.g["gitblame_" .. key] = value - end + local global_var_opts = {} + for k, _ in pairs(M.default_opts) do + global_var_opts[k] = vim.g["gitblame_" .. k] + end + + opts = vim.tbl_deep_extend("force", M.default_opts, global_var_opts, opts) + for k, v in pairs(opts) do + vim.g["gitblame_" .. k] = v end end