mirror of https://github.com/folke/lazy.nvim.git
fix(keys): properly deal with ft list for keys. Fixes #1448
This commit is contained in:
parent
9895337d1f
commit
82cf974e09
|
@ -163,11 +163,14 @@ end
|
|||
function M:_del(keys)
|
||||
-- bufs will be all buffers of the filetype for a buffer-local mapping
|
||||
-- OR `false` for a global mapping
|
||||
local bufs = keys.ft
|
||||
and vim.tbl_filter(function(buf)
|
||||
return vim.bo[buf].filetype == keys.ft
|
||||
local bufs = { false }
|
||||
|
||||
if keys.ft then
|
||||
local ft = type(keys.ft) == "string" and { keys.ft } or keys.ft --[[@as string[] ]]
|
||||
bufs = vim.tbl_filter(function(buf)
|
||||
return vim.tbl_contains(ft, vim.bo[buf].filetype)
|
||||
end, vim.api.nvim_list_bufs())
|
||||
or { false }
|
||||
end
|
||||
|
||||
for _, buf in ipairs(bufs) do
|
||||
pcall(vim.keymap.del, keys.mode, keys.lhs, { buffer = buf or nil })
|
||||
|
|
Loading…
Reference in New Issue