This repository was archived by the owner on Dec 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -932,21 +932,26 @@ function Plugin:keys(mappings)
932932 if type (mapping ) == ' table' then
933933 mode = mapping [1 ] or ' n'
934934 lhs = mapping [2 ]
935- rhs = mapping [3 ] or function () end
935+ rhs = mapping [3 ]
936936 opts = mapping [4 ] or {}
937937 else
938938 mode , lhs = ' n' , mapping
939- rhs = function () end
940939 opts = {}
941940 end
942941
943942 -- Create a keymap that loads the plugin first
944943 vim .keymap .set (mode , lhs , function ()
945- if self :load () and type (rhs ) == ' function' then
946- rhs ()
947- elseif self :load () and type (rhs ) == ' string' then
948- -- If rhs is a string command
949- vim .cmd (rhs )
944+ if type (rhs ) == ' function' then
945+ self :load (nil , rhs )
946+ elseif type (rhs ) == ' string' then
947+ self :load (nil , function () vim .cmd (rhs ) end )
948+ elseif type (rhs ) == ' nil' then
949+ -- If rhs not specified, it should be defined in plugin config
950+ -- In this case, we need to pass a callback
951+ self :load (nil , function ()
952+ vim .schedule (function ()
953+ vim .fn .feedkeys (lhs )
954+ end ) end )
950955 end
951956 end , opts )
952957 end
You can’t perform that action at this time.
0 commit comments