Thanks for the quick help. The v:errmsg does help me to know there are any error when running the command. However, I am experiancing another issue. Every time when the command exe "tag " . searchsymbol could not find the tag, it will print the error messages and ask me to press any key. Even when I put the silent such as exe "silent " . "tag " . searchsymbol, it still do the same. I want the script to handle the error silently and users do not need to know and press any key. Are there any solution for this?
Frank On Nov 25, 9:31 am, Gary Johnson <[email protected]> wrote: > On 2009-11-25, frank wang wrote: > > > Hi, > > > I am writing a vim script and I need to know whether the tag search > > failed or not. Does anyone know how to do it? For example, after > > execution > > > exe "tag " . searchsymbol > > > How do i know it fails to find the tag symbol? > > You could test the value of v:errmsg. See > > :help v:errmsg > > for an example. Alternatively, you could use a try block. See > > :help exception-handling > > HTH, > Gary --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
