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)
|
function M:_del(keys)
|
||||||
-- bufs will be all buffers of the filetype for a buffer-local mapping
|
-- bufs will be all buffers of the filetype for a buffer-local mapping
|
||||||
-- OR `false` for a global mapping
|
-- OR `false` for a global mapping
|
||||||
local bufs = keys.ft
|
local bufs = { false }
|
||||||
and vim.tbl_filter(function(buf)
|
|
||||||
return vim.bo[buf].filetype == keys.ft
|
if keys.ft then
|
||||||
end, vim.api.nvim_list_bufs())
|
local ft = type(keys.ft) == "string" and { keys.ft } or keys.ft --[[@as string[] ]]
|
||||||
or { false }
|
bufs = vim.tbl_filter(function(buf)
|
||||||
|
return vim.tbl_contains(ft, vim.bo[buf].filetype)
|
||||||
|
end, vim.api.nvim_list_bufs())
|
||||||
|
end
|
||||||
|
|
||||||
for _, buf in ipairs(bufs) do
|
for _, buf in ipairs(bufs) do
|
||||||
pcall(vim.keymap.del, keys.mode, keys.lhs, { buffer = buf or nil })
|
pcall(vim.keymap.del, keys.mode, keys.lhs, { buffer = buf or nil })
|
||||||
|
|
Loading…
Reference in New Issue