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.  (The :helpg works as usual
and removing :sil before RTPrestore causes it to write its
message to the command line area.

My original definition works perfectly.

-- 
Best regards,
Bill

Reply via email to