fix: more robust defaults
This commit is contained in:
parent
76c414adbf
commit
383c098548
1 changed files with 4 additions and 8 deletions
|
@ -1,6 +1,8 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.options = {
|
M.options = {}
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
hotkey = "<leader>tq",
|
hotkey = "<leader>tq",
|
||||||
quote_chars = { "'", '"', "`" },
|
quote_chars = { "'", '"', "`" },
|
||||||
}
|
}
|
||||||
|
@ -8,13 +10,7 @@ M.options = {
|
||||||
---Merges user-provided options with default options.
|
---Merges user-provided options with default options.
|
||||||
---@param user_options table|nil User-provided options
|
---@param user_options table|nil User-provided options
|
||||||
function M.setup(user_options)
|
function M.setup(user_options)
|
||||||
if user_options and type(user_options) == "table" then
|
M.options = vim.tbl_deep_extend("force", {}, defaults, user_options or {})
|
||||||
for k, v in pairs(user_options) do
|
|
||||||
if v ~= nil then
|
|
||||||
M.options[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local map_opts = {
|
local map_opts = {
|
||||||
desc = "Swaps the quotes around",
|
desc = "Swaps the quotes around",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue