Re: Checking return codes?
>> Is it possible to check the return code of an Ex command? I currentlyThe getqflist() is the approach I took:
>> function! Grep(pattern, location)
>> exe "noautocmd vimgrep /" . a:pattern . "/gj " . a:location " | copen"
>> which causes an error with copen if vimgrep doesn't return anything.
>> I'd like to handle the error a little more gracefully if possible.
> You can use a :try :catch block and catch pattern E480.
> (Seems like the help tag E480 is wrong).
> And you can also check, whether the result returned by getqflist() is
function! Grep(pattern, location)
exe "noautocmd vimgrep /" . a:pattern . "/gj " . a:location
silent exe 'copen'
which works nicely for me.
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
To unsubscribe, reply using "remove me" as the subject.