5 function VaptGet(command_arg, package_arg, ...)
6 let vapt_command = ''
7 let command_list = ['install', 'remove']
8 echo command_list
9 for commands in command_list:
10 if commands == a:command_arg:
11 let vapt_command = commands
12 endif
13 endfor
14 echo a:package_arg
15 echo "hello world"
16 endfunction
17 command! -nargs=* VaptGet call VaptGet(<f-args>)
当我运行时:
:VaptGet install tab
我得到:
['install', 'remove']
Error detected while processing function VaptGet:
line 4:
E121: Undefined variable: command_list:
E15: Invalid expression: command_list:
tab
hello world
有人可以告诉我为什么command_list
缺少 var