Problems using v:errmsg

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problems using v:errmsg

David Woodfall
I'm trying to detect whether or not a g// command worked by checking
v:errmsg. AFAICT this is almost identical to the example to the
example in :help errmsg, although there it is using 'silent! next':

let v:errmsg = ""
silent! g/^>/

if v:errmsg == ""
   silent g/^-- $/
   silent g/^>/
   normal 2o
   normal o
However it doesn't seem to work. Whatever I try, v:errmsg is always
empty so the first part of the if statement will run. I've tried with
and without the '!' and also by using normal instead of silent. Doing
:echomsg v:errmsg or :messages after vim has been invoked will always
be empty too.

Any ideas?



"Linux was made by foreign terrorists to take money from true US companies
like Microsoft." - Some AOL'er.
"To this end we dedicate ourselves..." -Don
  -- From the sig of "Don", [hidden email]

                                                            .--.  oo

You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit

You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit