Fix key checking

This commit is contained in:
hrsh7th
2021-08-14 16:25:15 +09:00
parent 036bf1af62
commit 5cc6c61a7e

View File

@@ -52,8 +52,10 @@ end
keymap.feedkeys = setmetatable({ keymap.feedkeys = setmetatable({
callbacks = {}, callbacks = {},
}, { }, {
__call = function(self, keys, mode, callback) __call = function(self, keys, mode, callback)
vim.fn.feedkeys(keymap.t(keys), mode) if #keys ~= 0 then
vim.fn.feedkeys(keymap.t(keys), mode)
end
if callback then if callback then
local current_mode = string.sub(vim.api.nvim_get_mode().mode, 1, 1) local current_mode = string.sub(vim.api.nvim_get_mode().mode, 1, 1)
@@ -102,7 +104,7 @@ keymap.listen = setmetatable({
if existing then if existing then
break break
end end
if map.lhs == keys then if keymap.t(map.lhs) == keymap.t(keys) then
existing = map existing = map
end end
end end
@@ -110,7 +112,7 @@ keymap.listen = setmetatable({
if existing then if existing then
break break
end end
if map.lhs == keys then if keymap.t(map.lhs) == keymap.t(keys) then
existing = map existing = map
break break
end end