strict mapping handling

This commit is contained in:
hrsh7th
2021-11-08 20:38:08 +09:00
parent 1628c934d1
commit f831dbc107
2 changed files with 4 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ feedkeys.call = setmetatable({
table.insert(queue, { keymap.t('<Cmd>set %slazyredraw<CR>'):format(vim.o.lazyredraw and '' or 'no'), 'n' }) table.insert(queue, { keymap.t('<Cmd>set %slazyredraw<CR>'):format(vim.o.lazyredraw and '' or 'no'), 'n' })
table.insert(queue, { keymap.t('<Cmd>set eventignore=%s<CR>'):format(vim.o.eventignore or ''), 'n' }) table.insert(queue, { keymap.t('<Cmd>set eventignore=%s<CR>'):format(vim.o.eventignore or ''), 'n' })
end end
if callback then if callback then
local id = misc.id('cmp.utils.feedkeys.call') local id = misc.id('cmp.utils.feedkeys.call')
self.callbacks[id] = callback self.callbacks[id] = callback
@@ -37,6 +38,7 @@ feedkeys.call = setmetatable({
vim.api.nvim_feedkeys(queue[i][1], queue[i][2], queue[i][3]) vim.api.nvim_feedkeys(queue[i][1], queue[i][2], queue[i][3])
end end
end end
if is_immediate then if is_immediate then
vim.api.nvim_feedkeys('', 'x', true) vim.api.nvim_feedkeys('', 'x', true)
end end

View File

@@ -16,7 +16,7 @@ end
keymap.normalize = function(keys) keymap.normalize = function(keys)
vim.api.nvim_set_keymap('t', '<Plug>(cmp.utils.keymap.normalize)', keys, {}) vim.api.nvim_set_keymap('t', '<Plug>(cmp.utils.keymap.normalize)', keys, {})
for _, map in ipairs(vim.api.nvim_get_keymap('t')) do for _, map in ipairs(vim.api.nvim_get_keymap('t')) do
if map.lhs == '<Plug>(cmp.utils.keymap.normalize)' then if keymap.equals(map.lhs, '<Plug>(cmp.utils.keymap.normalize)') then
return map.rhs return map.rhs
end end
end end
@@ -196,7 +196,7 @@ keymap.evacuate = function(bufnr, mode, lhs)
elseif not map.noremap then elseif not map.noremap then
-- remap & non-expr mapping should be checked if recursive or not. -- remap & non-expr mapping should be checked if recursive or not.
rhs = keymap.recursive(bufnr, mode, lhs, rhs) rhs = keymap.recursive(bufnr, mode, lhs, rhs)
if rhs == map.rhs or map.noremap then if keymap.equals(rhs, map.rhs) or map.noremap then
return { keys = rhs, mode = 'it' .. (map.noremap and 'n' or '') } return { keys = rhs, mode = 'it' .. (map.noremap and 'n' or '') }
end end
else else