I am trying to catch an error (E490) in Vim like this:
:try | foldopen! | catch | | endtry
Still, when executing this, Vim shows the error:
Error detected while processing :
E490: No fold fo开发者_如何学Gound
I would like to open all folds if any are present.
Any ideas?
Looks like a bug: your version shows an error,
:execute 'try | foldopen! | catch | | endtry'
acts like
:echo 'try | foldopen! | catch | | endtry'
without folds.
Try the following workaround:
:execute "try\n foldopen!\ncatch\nendtry'
By the way, there is a better way if you want to ignore all errors:
:silent! foldopen!
Note that it won't purge messages from redirection if it is present, while try...catch
will.
精彩评论