On 03/18/2011 11:27 AM, Bram Moolenaar wrote:
Tim Chase wrote:
:try | /does_not_exist/ | catch /.*/ | endtry
"""
Error detected while processing :
E486: Pattern not found: does_not_exist
"""
You need to put the "catch" on a separate line, because when skipping
commands it will skip the line(s) after where the error happened. That's
because when there is an error finding the " | " is unreliable.
Hmmm...peculiar given the help example from ":help :throw"
:try | throw "oops" | catch /^oo/ | echo "caught" | endtry
suggests that an exception being thrown can be caught by a :catch
in the same line.
My assumption that a single line-destination (whether line-number
or search) would be treated as a command seems consistent with
the scattered documentation I've found on it (emphasis on them
being called "*commands*" is mine):
cmdline.txt|554 col 1| :3 goto line 3
referred to as "strange *commands*"
options.txt|1969 col 23| CTRL-N, CTRL-J and ":1234".
"Applies to the *commands*"
options.txt|6232 col 32| only has a line number, e.g., ":25" or ":+".
"Also for an Ex *command* that only has a line number"
While I consider this a bug, at a minimum, the gotcha regarding
catch being on its own line doesn't seem to be readily documented
in the section on :try and :catch
-tim
--
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