First thing you need to do is get the syntax of :command
right. This is what
it's supposed to be...
:com[mand][!] [{attr}...] {cmd} {rep}
{attr}
means attributes. That includes the -nargs
value. Following that is {cmd}
which is the command name.
That gives us this...
:command -nargs=1 Tab call SetTab(<args>)
Problem is, it still won't work.
What you need next is to clean up the data you're passing to your function. <args>
is not intended to be used as argument(s) to a user function. Instead you should use <f-args>
But don't take my word for it. Quoting :h <f-args>
, the purpose is...
...to allow commands to pass their arguments on to a user-defined function, there is a special form ("function args"). This splits the command arguments at spaces and tabs, quotes each argument individually, and the sequence is replaced by the comma-separated list of quoted arguments.
That's just an excerpt. Be sure to read the whole thing! There's also example code following it that does something similar to all this.
Anyways, this is what we have now...
:command -nargs=1 Tab call SetTab(<f-args>)
...and that should do the trick.