fix(scope): allow user to disable keys

This commit is contained in:
Iordanis Petkakis 2025-05-26 13:03:51 +03:00
parent bc0630e43b
commit 07f6f79d2d

View file

@ -774,14 +774,18 @@ end
function M.setup()
local keys = Snacks.config.get("scope", defaults).keys
for key, opts in pairs(keys.textobject) do
vim.keymap.set({ "x", "o" }, key, function()
M.textobject(opts)
end, { silent = true, desc = opts.desc })
if opts then
vim.keymap.set({ "x", "o" }, key, function()
M.textobject(opts)
end, { silent = true, desc = opts.desc })
end
end
for key, opts in pairs(keys.jump) do
vim.keymap.set({ "n", "x", "o" }, key, function()
M.jump(opts)
end, { silent = true, desc = opts.desc })
if opts then
vim.keymap.set({ "n", "x", "o" }, key, function()
M.jump(opts)
end, { silent = true, desc = opts.desc })
end
end
end