mirror of https://github.com/folke/lazy.nvim.git
fix(keys): buffer-local nop mappings
This commit is contained in:
parent
0c1ec520af
commit
ff90417808
|
@ -102,6 +102,11 @@ function M.opts(keys)
|
|||
return opts
|
||||
end
|
||||
|
||||
---@param keys LazyKeys
|
||||
function M.is_nop(keys)
|
||||
return type(keys.rhs) == "string" and (keys.rhs == "" or keys.rhs:lower() == "<nop>")
|
||||
end
|
||||
|
||||
---@param keys LazyKeys
|
||||
function M:_add(keys)
|
||||
local lhs = keys.lhs
|
||||
|
@ -109,7 +114,7 @@ function M:_add(keys)
|
|||
|
||||
---@param buf? number
|
||||
local function add(buf)
|
||||
if type(keys.rhs) == "string" and (keys.rhs == "" or keys.rhs:lower() == "<nop>") then
|
||||
if M.is_nop(keys) then
|
||||
return self:_set(keys, buf)
|
||||
end
|
||||
|
||||
|
@ -147,7 +152,7 @@ function M:_add(keys)
|
|||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = keys.ft,
|
||||
callback = function(event)
|
||||
if self.active[keys.id] then
|
||||
if self.active[keys.id] and not M.is_nop(keys) then
|
||||
add(event.buf)
|
||||
else
|
||||
-- Only create the mapping if its managed by lazy
|
||||
|
|
Loading…
Reference in New Issue