On Sat, Nov 11, 2006 at 01:12:15AM +0200, Yakov Lerner wrote:
> When I use command that generates error under silent!, I see
> that v:errmsg is not assigned. For example:
> 
>     let v:errmsg ='' | let @/='lasjkdlsjklskj'
>     silent! exe "norm! n"
>     echo v:errmsg
> 
> - this prints empty v:errmsg, although "norm! n" generated an error.
> 
> How can I silently execute command but get it's error message,
> do not lose it's v:errmsg ? (I suspect try+catch can do this, but I'm
> not sure how.)
> 
> Thanks
> Yakov

     I find that v:errmsg is set with this experiment:

:let v:errmsg = ''
:let @/ = 'gfdgdasass'
:silent! exe "norm! n"
:echo v:errmsg
E486: Pattern not found: gfdgdasass

I am still using vim 7.0.000.

     I also notice that silent! does not prevent error messages from
being :redir-ected.  Both of these points agree with the docs:

:help :silent

HTH                                     --Benji Fisher

Reply via email to