From 26fb642ff3a4def5377b646695a48ba1927d449b Mon Sep 17 00:00:00 2001 From: Bazaah Date: Sun, 18 Aug 2024 18:08:49 +0000 Subject: [PATCH] fix(map_util): insert bindings for , and :Cmd work Co-authored-by: Oliver Marshall --- lua/dressing/map_util.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lua/dressing/map_util.lua b/lua/dressing/map_util.lua index af1e41a..f833f8a 100644 --- a/lua/dressing/map_util.lua +++ b/lua/dressing/map_util.lua @@ -35,19 +35,15 @@ M.create_maps_to_plug = function(bufnr, mode, bindings, prefix) end end -- Prefix with unless this is a or :Cmd mapping - if type(rhs) == "string" and not rhs:match("[<:]") then - rhs = "" .. prefix .. rhs - end - if mode == "i" then - -- HACK for some reason I can't get plug mappings to work in insert mode - 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 + if type(rhs) == "string" then + if not rhs:match("[<:]") then + rhs = "" .. prefix .. rhs + end + if mode == "i" then + rhs = "" .. rhs end end + ---@cast rhs string vim.keymap.set(mode, lhs, rhs, opts) end