File tree 1 file changed +17
-5
lines changed
1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -110,23 +110,35 @@ function M.setup()
110
110
-- commands
111
111
Util .track (" loader_commands" )
112
112
for cmd , plugins in pairs (M .loaders .cmd or {}) do
113
- vim . api . nvim_create_user_command ( cmd , function ( event )
113
+ local function _load ( complete )
114
114
vim .api .nvim_del_user_command (cmd )
115
- Util .track (" cmd: " .. cmd )
116
- M .load (plugins )
115
+ if complete then
116
+ Util .track (" cmd-complete: " .. cmd )
117
+ else
118
+ Util .track (" cmd: " .. cmd )
119
+ end
120
+ M .load (plugins , { cmd = cmd })
121
+ Util .track ()
122
+ end
123
+ vim .api .nvim_create_user_command (cmd , function (event )
124
+ _load ()
117
125
vim .cmd (
118
126
(" %s %s%s%s %s" ):format (
119
127
event .mods or " " ,
120
128
event .line1 == event .line2 and " " or event .line1 .. " ," .. event .line2 ,
121
129
cmd ,
122
130
event .bang and " !" or " " ,
123
- event .args
131
+ event .args or " "
124
132
)
125
133
)
126
- Util .track ()
127
134
end , {
128
135
bang = true ,
129
136
nargs = " *" ,
137
+ complete = function ()
138
+ _load (true )
139
+ -- HACK: trick Neovim to show the newly loaded command completion
140
+ vim .api .nvim_input (" <space><bs><tab>" )
141
+ end ,
130
142
})
131
143
end
132
144
Util .track ()
You can’t perform that action at this time.
0 commit comments