Vigil wrote:
> On Sun, 25 Mar 2007, Bram Moolenaar wrote:
>
> > You apparently really want to pass ${*} to the shell command. The help
> > for makeprg explains replacing $* with the name of the file, but you use
> > "%" for that.
>
> My help says that $* is replaced with the arguments, which I take to
> mean -T in my example:
>
> The placeholder "$*" can be given (even multiple times) to specify
> where the arguments will be included
>
> It doesn't say anything about the filename. Maybe it needs to
> distinguish which arguments it is referring to.
Sorry, "$*" is indeed replaced by the ":make" arguments, not the file name.
> > This probably also works:
> >
> > setlocal makeprg=/usr/share/vim/vim70/tools/efm_perl.pl\ -c\ -w\ $*
>
> Nope. When I replace efm_perl.pl with efm_perl2.pl, a simple script that
> outputs the arguments it was called with, and I have
>
> set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ ${*}\ %
>
> and I call ":make" on the file that I have open ('binary.pl'), efm_perl2.pl
> outputs
>
> Called with: -c -w binary.pl
>
> When I call it with ":make -T", it outputs
>
> Called with: -c -w binary.pl -T
What happens here is that ${*} is changed by the shell to an empty
string. Then % is changed to the file name, and the other arguments
follow, since you don't use $*. If you leave out ${*} you get the same
result.
> Now, if I change the makeprg thus:
>
> set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ $*
>
> and call ":make":
>
> Called with: -c -w
>
> and ":make -T":
>
> Called with: -c -w -T
>
> As you can see, the filename of the current buffer is not passed to the
> makeprg.
No, but the argument is. Thus these two are equivalent:
set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ % $*
set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ %
Because when $* is not used you get the arguments anyway.
> Further experimentation reveals that the order of "%\ ${*}" or "${*}\
> %" makes no difference to the arguments that efm_perl2.pl is passed,
> nor their order. Indeed, ${*} is superfluous, but it does seem that I
> need % to substitute both the filename AND any arguments I give to
> :make.
>
> $* and all variations of braces in and around it, just doesn't work.
>
> This option may contain '%' and '#' characters, which are
> expanded like when used in a command-line.
>
> I think that needs explaining a bit more. To me, % is used when
> specifying the entire range of the file on the vim command line, and #
> prints lines with their respective line numbers :/
This refers to using them in an argument. That should be mentioned,
I'll adjust the text.
--
It is illegal for anyone to give lighted cigars to dogs, cats, and other
domesticated animal kept as pets.
[real standing law in Illinois, United States of America]
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///