Am 13.09.2018 um 17:10 schrieb Dave 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
> else
> normal o
> startinsert
> endif
>
> 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?
>
> -Dave
You may check v:statusmsg instead, because a :global command without
match does not produce an *error*.
--
Andy
--
--
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 http://www.vim.org/maillist.php
---
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment