merge: master <--- fix/insert-mode-keybinds
* HEAD | \ | *114ed13
<github@luxolus.com> fix(map_util): add `<CR>` after string bindings | *26fb642
<github@luxolus.com> fix(map_util): insert bindings for <Plug>, <Cmd> and :Cmd work | / | master Signed-off-by: Bazaah <github@luxolus.com>
This commit is contained in:
commit
545479084f
|
@ -35,19 +35,17 @@ M.create_maps_to_plug = function(bufnr, mode, bindings, prefix)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Prefix with <Plug> unless this is a <Cmd> or :Cmd mapping
|
-- Prefix with <Plug> unless this is a <Cmd> or :Cmd mapping
|
||||||
if type(rhs) == "string" and not rhs:match("[<:]") then
|
if type(rhs) == "string" then
|
||||||
rhs = "<Plug>" .. prefix .. rhs
|
if not rhs:match("[<:]") then
|
||||||
|
rhs = "<Plug>" .. prefix .. rhs .. "<CR>"
|
||||||
|
else
|
||||||
|
rhs = rhs .. "<CR>"
|
||||||
end
|
end
|
||||||
if mode == "i" then
|
if mode == "i" then
|
||||||
-- HACK for some reason I can't get plug mappings to work in insert mode
|
rhs = "<C-o>" .. rhs
|
||||||
for _, map in ipairs(maps) do
|
|
||||||
if map.lhs == rhs then
|
|
||||||
---@diagnostic disable-next-line: cast-local-type
|
|
||||||
rhs = map.callback or map.rhs
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@cast rhs string
|
---@cast rhs string
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
vim.keymap.set(mode, lhs, rhs, opts)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue