On 9/17/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:
On Sun 17-Sep-06 4:18pm -0600, you wrote:

> Bill McCarthy wrote:
>> Hello Vim List,
>>
>> I wrote a command to perform :helpgrep on just the
>> distribution help files.  My first pass was:
>>
>>     command! -nargs=1 HG sil RTPtemp
>>         \ | exe 'helpg <args>'
>>         \ | sil RTPrestore
>>
>> RTPtemp and RTPrestore are commands taking no args (they are
>> defined below my sig).
>>
>> To get this to work, I had to enclose 'sil RTPtemp' in an
>> 'exe':
>>
>>     command! -nargs=1 HG exe 'sil RTPtemp'
>>         \ | exe 'helpg <args>'
>>         \ | sil RTPrestore
>>
>> Why?
>>

> RTPtemp is defined without -bar. Therefore

>    :sil RTPtemp | exe 'helpg <args>' | sil RTPrestore

> is invalid.

> But if it were defined with -bar, the whole text would be seen as
> argument of the first ":silent". You need ":exe" to terminate the first
> ":silent" before ":exe 'helpg <args>'".

Thanks for the '-bar' tip!

However, including -bar in my definitions for both
RTPrestore and RTPtemp, does not appear to cause the :sil to
apply to more than the RTPtemp.

You cannot just put bar-separate sequence of commands under :silent.
In the bar-separated sequence of commands, you need to
prepend :silent to every command.

You can try [to give yourself problems] by something line
:silent exe "cmd1|cmd2|cmd3" but this will not work for you
because of helpg, and yuu'll need really elaborate
embedded quoting.

I suggest that you stick to sil cmd1|sil cmd2 |sil cmd3

Yakov

Reply via email to