The plugin crashes when recovering a Lua-callback map in Neovim.
Reproduction
Run Neovim with the following config:
-- .config/nvim/init.lua
-- | Fetches Lazy if not present.
function bootstrap_lazy()
local lazypath = vim.fn.stdpath('data')..'/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system{
'git', 'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
end
bootstrap_lazy()
require'lazy'.setup({
{ 'unblevable/quick-scope',
init = function()
-- Trigger a highlight in the appropriate direction when pressing these keys:
vim.g.qs_highlight_on_keys = { 'f', 'F', 't', 'T' }
end,
},
{ 'greymd/oscyank.vim',
keys = '<C-c>',
},
}
)
Open Neovim
nvim .config/nvim/init.lua
Press fc (to jump to c).
You'll see the following error:
Error detected while processing function quick_scope#Reload[6]..quick_scope#mapping#Restore:
line 13:
E716: Key not present in Dictionary: "rhs, '|'), '<SID>', '<SNR>' . a:mapping.sid . '_', 'g')"
E116: Invalid arguments for function escape
E116: Invalid arguments for function substitute
Problem
The plugin crashes when recovering a Lua-callback map in Neovim.
Reproduction
Run Neovim with the following config:
Open Neovim
Press
fc
(to jump to c).You'll see the following error:
Solution
The problem stems from the fact that Neovim may have a Lua callback instead of rhs (https://github.com/neovim/neovim/issues/22399):
I suggest this plugin uses
mapset
instead of its custom restore function.