File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 28
28
29
29
--- @param value string | LazyKeys
30
30
function M .parse (value )
31
- return (type (value ) == " string" and { value } or value ) --[[ @as LazyKeys]]
31
+ local ret = vim .deepcopy (value )
32
+ ret = (type (ret ) == " string" and { ret } or ret ) --[[ @as LazyKeys]]
33
+ ret .mode = ret .mode or " n"
34
+ return ret
32
35
end
33
36
34
37
function M .opts (keys )
45
48
function M :_add (value )
46
49
local keys = M .parse (value )
47
50
local lhs = keys [1 ]
48
- vim .keymap .set (keys .mode or " n" , lhs , function ()
51
+ local opts = M .opts (keys )
52
+ opts .noremap = false
53
+ vim .keymap .set (keys .mode , lhs , function ()
49
54
Util .track ({ keys = lhs })
50
55
self :_del (value )
51
56
Loader .load (self .active [value ], { keys = lhs })
52
57
M .retrigger (lhs )
53
58
Util .track ()
54
- end , M . opts ( keys ) )
59
+ end , opts )
55
60
end
56
61
57
62
--- @param value string | LazyKeys
58
63
function M :_del (value )
59
64
local keys = M .parse (value )
60
- pcall (vim .keymap .del , " n" , keys [1 ])
65
+ vim .pretty_print (keys )
66
+ pcall (vim .keymap .del , keys .mode , keys [1 ])
61
67
if keys [2 ] then
62
- vim .keymap .set (keys .mode or " n " , keys [1 ], keys [2 ], M .opts (keys ))
68
+ vim .keymap .set (keys .mode , keys [1 ], keys [2 ], M .opts (keys ))
63
69
end
64
70
end
65
71
You can’t perform that action at this time.
0 commit comments