fix(keymap): make sure opts are a table. Closes #2392

This commit is contained in:
Folke Lemaitre 2025-10-30 07:56:38 +01:00
parent 46917d0629
commit 367d1bd385
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -73,7 +73,7 @@ end
---@return T opts, string[]? fts, vim.lsp.get_clients.Filter? lsp, fun(buf?:number) enabled ---@return T opts, string[]? fts, vim.lsp.get_clients.Filter? lsp, fun(buf?:number) enabled
local function get_opts(...) local function get_opts(...)
---@type snacks.keymap.set.Opts|snacks.keymap.del.Opts ---@type snacks.keymap.set.Opts|snacks.keymap.del.Opts
local opts = Snacks.config.merge(...) local opts = Snacks.config.merge({}, ...)
opts.silent = opts.silent ~= false opts.silent = opts.silent ~= false
opts.buffer = (opts.buffer == 0 or opts.buffer == true) and vim.api.nvim_get_current_buf() or opts.buffer opts.buffer = (opts.buffer == 0 or opts.buffer == true) and vim.api.nvim_get_current_buf() or opts.buffer
local fts = opts.ft and (type(opts.ft) == "table" and opts.ft or { opts.ft }) or nil --[[@as string[] ]] local fts = opts.ft and (type(opts.ft) == "table" and opts.ft or { opts.ft }) or nil --[[@as string[] ]]