File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,30 @@ M.name = 'RenderMarkdown'
99--- @private
1010M .plugin = ' render-markdown.nvim'
1111
12+ local starts_with = function (str , start )
13+ return str :sub (1 , # start ) == start
14+ end
15+
16+ local get_matching_values = function (value , potential_values )
17+ local matching_values = {}
18+ for _ , potential_value in ipairs (potential_values ) do
19+ if starts_with (potential_value , value ) then
20+ table.insert (matching_values , potential_value )
21+ end
22+ end
23+ return matching_values
24+ end
25+
1226--- Should only be called from plugin directory
1327function M .setup ()
1428 vim .api .nvim_create_user_command (M .name , M .command , {
1529 nargs = ' *' ,
1630 desc = M .plugin .. ' commands' ,
17- complete = function (_ , cmdline )
31+ complete = function (ArgLead , cmdline )
1832 if cmdline :find (M .name .. ' %s+%S+%s+.*' ) then
1933 return {}
2034 elseif cmdline :find (M .name .. ' %s+' ) then
21- return vim .tbl_keys (api )
35+ return get_matching_values ( ArgLead , vim .tbl_keys (api ) )
2236 else
2337 return {}
2438 end
You can’t perform that action at this time.
0 commit comments