When a vim script is to be watched for errors and interrupts,
try is put somewhere near the beginning and
catch after a long sequence of code. In this sequence of code it is very probable to have some condition commands, i.e.,
if … endif, etc. Now when I type
CTRL-C or an error occurs, this happens randomly with respect to the location in code, e.g., after
if and before
endif. Thus it is natural that
catch gives the error message, i.e.,
missing :endif and terminates the script.
How can I handle this situation in vim?