Add comments
This commit is contained in:
@@ -136,6 +136,7 @@ keymap.evacuate = setmetatable({
|
|||||||
|
|
||||||
local callback = not existing.expr and existing.callback
|
local callback = not existing.expr and existing.callback
|
||||||
keymap.set_map(bufnr, mode, fallback, function()
|
keymap.set_map(bufnr, mode, fallback, function()
|
||||||
|
-- Make resolved key sequence.
|
||||||
local lhs = keymap.t(existing.lhs)
|
local lhs = keymap.t(existing.lhs)
|
||||||
local rhs
|
local rhs
|
||||||
if existing.callback then
|
if existing.callback then
|
||||||
@@ -146,11 +147,13 @@ keymap.evacuate = setmetatable({
|
|||||||
rhs = keymap.t(existing.rhs)
|
rhs = keymap.t(existing.rhs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Resolve recursive mapping. See `:help recursive_mapping`.
|
||||||
if not existing.noremap then
|
if not existing.noremap then
|
||||||
if string.find(rhs, lhs, 1, true) == 1 then
|
if string.find(rhs, lhs, 1, true) == 1 then
|
||||||
rhs = string.gsub(rhs, '^' .. vim.pesc(lhs), string.format(keymap.t([[<C-r>=v:lua.vim.json.decode(%s)<CR>]]), vim.fn.string(vim.json.encode(lhs))))
|
rhs = string.gsub(rhs, '^' .. vim.pesc(lhs), string.format(keymap.t([[<C-r>=v:lua.vim.json.decode(%s)<CR>]]), vim.fn.string(vim.json.encode(lhs))))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return rhs
|
return rhs
|
||||||
end, callback and {
|
end, callback and {
|
||||||
expr = false,
|
expr = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user