Closed ghost closed 9 years ago
No, actually in this case only one argument was passed... I think vim behaves like that because we specify -nargs=1
.
What is the use case, btw?
No, actually in this case only one argument was passed
I don't understand... how is 01-vim-beginner 02-vim-intermediate
not two arguments? Does Vim behave differently than how things are done in the shell (in this case)?
What is the use case, btw?
:VimTutor
has n-args=0
, so :VimTutor jsalkdjsalkdjsa
prints E488: Trailing characters
as expected.
:Tutor
has -nargs=1
, but :Tutor 01-vim-beginner 02-vim-intermediate
instead prints "No tutorials with that name found."
, which is incorrect for both arguments. IMO it should either open both tutorials in separate buffers, or just print E488: Trailing characters
if there's more than one argument.
I see. No, vim will treat that as a single argument, it won't split on the space.
From :help command-nargs
:
-nargs=1 Exactly one argument is required, it includes spaces
We should add some extra logic so it catches this scenario. IMHO, it should open the first "argument" and ignore the rest, perhaps displaying a warning to the user. Because, really, does it make sense to open several tutorials at once (unless you are a tutorial writer, in which case you shouldn't be using :Tutor
anyway)?
We should add some extra logic so it catches this scenario. IMHO, it should open the first "argument" and ignore the rest, perhaps displaying a warning to the user.
That sounds odd, perhaps just display a warning?
Because, really, does it make sense to open several tutorials at once (unless you are a tutorial writer, in which case you shouldn't be using :Tutor anyway)?
Good point
edit: misquoted you
That sounds odd, perhaps just display a warning?
Yeah, you're right. No point in trying to be too clever.
:Tutor
is being defined this way:I don't know much about VimScript, but what I expected is that
:Tutor
would fail in such a situation, given that-nargs=1
is specified and two arguments were passed. Does<f-args>
not honor-nargs=n
or something?