fix(keys): make sure we don't delete the global mapping when executing an ft keymap. See #1241

This commit is contained in:
Folke Lemaitre 2024-01-21 11:10:24 +01:00
parent ababf0dab5
commit a9b9a4b3a2
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 5 additions and 1 deletions

View File

@ -163,7 +163,11 @@ end
-- mapping when needed -- mapping when needed
---@param keys LazyKeys ---@param keys LazyKeys
function M:_del(keys) function M:_del(keys)
pcall(vim.keymap.del, keys.mode, keys.lhs) pcall(vim.keymap.del, keys.mode, keys.lhs, {
-- NOTE: for buffer-local mappings, we only delete the mapping for the current buffer
-- So the mapping could still exist in other buffers
buffer = keys.ft and true or nil,
})
-- make sure to create global mappings when needed -- make sure to create global mappings when needed
-- buffer-local mappings are managed by lazy -- buffer-local mappings are managed by lazy
if not keys.ft then if not keys.ft then