File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,11 +56,23 @@ for module_name in module_names:
5656 module = importlib.util.module_from_spec (spec)
5757 spec.loader.exec_module (module)
5858 functions = [f for f in dir (module) if callable (getattr (module, f ))]
59+ suggestions = str (functions)
5960
6061 command_name = module_name.capitalize ()
62+
63+ vim .command (f " " "
64+ function ! Complete{command_name}(ArgLead, CmdLine, CursorPos) abort
65+ let cmd_parts = split (a: CmdLine )
66+ if len (cmd_parts) == 1
67+ return {suggestions}
68+ else
69+ return []
70+ endif
71+ endfunction
72+ " "")
73+
6174 command_string = ' call CallPythonFunction("' + command_name + ' ", "' + module_name + ' ", <q-args>)'
62- command = ' command! -nargs=* ' + command_name + ' :execute \'' + command_string + ' \' '
63- print (command )
75+ command = ' command! -nargs=* -complete=customlist,Complete' + command_name + ' ' + command_name + ' :execute \'' + command_string + ' \' '
6476 vim .command (command )
6577EOF
6678endfunction
You can’t perform that action at this time.
0 commit comments