mirror of
https://github.com/neovim/neovim.git
synced 2026-07-06 09:35:18 +00:00
fix: don't mutate opts parameter of vim.keymap.del
`vim.keymap.del` takes an `opts` parameter that lets caller refer to and
delete buffer-local mappings. For some reason the implementation of
`vim.keymap.del` mutates the table that is passed in, setting
`opts.buffer` to `nil`. I'm not sure why it does this since `opts` is
never again accessed/used by the implementation anyway.
This seems wrong and is also undocumented. This bit me because I was
setting and then later unsetting a collection of mappings for some
buffer, and I created a local `opts = {buffer=my_buffer_number}`, and
then I got "no such mapping" errors.
This commit is contained in:
@@ -130,7 +130,6 @@ function keymap.del(modes, lhs, opts)
|
||||
local buffer = false
|
||||
if opts.buffer ~= nil then
|
||||
buffer = opts.buffer == true and 0 or opts.buffer
|
||||
opts.buffer = nil
|
||||
end
|
||||
|
||||
if buffer == false then
|
||||
|
||||
Reference in New Issue
Block a user