Is it possible to pass arguments to Vimscript functions with the --argument
or -a
format, similar to arguments in the command line?
I am writing a command that submits a job in a remote machine. I have to pass the number of hours and the number of CPUs requested. Currently they are provided as positional parameters.
function! SubmitJob(hours,cpus)
...
endfunction
com -nargs=* Submit call SubmitJob(<f-args>)
For example, :Submit 1 2
indicates 1 hour and 2 CPUs. Would it be possible to change the function and command above so that I can pass the arguments as :Submit --hours 1 --cpus 2
or :Submit -h 1 -c 2
? This way, it would be possible to change the parameter order, for example :Submit --cpus 2 --hours 1
.