Skip to content

Commit

Permalink
fix(keys): make sure we don't delete the global mapping when executin…
Browse files Browse the repository at this point in the history
…g an ft keymap. See #1241
  • Loading branch information
folke committed Jan 21, 2024
1 parent ababf0d commit a9b9a4b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lazy/core/handler/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ end
-- mapping when needed
---@param keys LazyKeys
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
-- buffer-local mappings are managed by lazy
if not keys.ft then
Expand Down

0 comments on commit a9b9a4b

Please sign in to comment.