From 383c09854839d5e78a204852ff8ae01ac4f0adf6 Mon Sep 17 00:00:00 2001 From: jank Date: Mon, 28 Jul 2025 19:48:29 +0200 Subject: [PATCH] fix: more robust defaults --- lua/jquote/init.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lua/jquote/init.lua b/lua/jquote/init.lua index 7a8bd97..0726a50 100644 --- a/lua/jquote/init.lua +++ b/lua/jquote/init.lua @@ -1,6 +1,8 @@ local M = {} -M.options = { +M.options = {} + +local defaults = { hotkey = "tq", quote_chars = { "'", '"', "`" }, } @@ -8,13 +10,7 @@ M.options = { ---Merges user-provided options with default options. ---@param user_options table|nil User-provided options function M.setup(user_options) - if user_options and type(user_options) == "table" then - for k, v in pairs(user_options) do - if v ~= nil then - M.options[k] = v - end - end - end + M.options = vim.tbl_deep_extend("force", {}, defaults, user_options or {}) local map_opts = { desc = "Swaps the quotes around",