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 found
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With