I suddenly receive Error detected while processing function <SNR>30_Highlight_Matching_Pair when I want to write parantheses or when moving over parantheses. I can turn off these error message with


Unfortunatly, I am unable to reconstruct what I have changed in my environment, possibly in the vimrc file. Does someone have an idea where I have to look to turn this behavior off?

  • most likely this will go away if you update vim to a recent version – Mass Jan 25 '19 at 13:41
  • 1
    Are more info on the error printed (like line number)? You might want to add info about OS and Vim version to your question. – Ralf Jan 25 '19 at 15:28
  • Probably it complained about invalid argument: 0 and that is correct. The plugin should return '0' instead of 0. This has been fixed in a later runtime file update, so make sure you have the latest matchparen plugin and not an outdated version laying around. See also the related issue github.com/vim/vim/issues/3225 – Christian Brabandt Jan 28 '19 at 13:07
  • @ChristianBrabandt this was exactly it. You might want to turn your comment into an answer so that I can accdept it. – René Nyffenegger Jan 29 '19 at 19:58
  • Okay, thanks, will post an answer later tomorrow – Christian Brabandt Jan 29 '19 at 20:27

The error you see, comes from the plugin matchparen, that is distributed with vim and which does highlight the matching parenthesis as you edit them. Internally is uses the searchpairpos() function.

Starting with Vim patch 8.1.0112, Vim will throw an error, if the skip argument for the functions searchpair() and searchpairpos() is not a string argument.

That caused the error message invalid argument: 0, because the two plugins matchparen and matchpair that come with Vim, used a skip expression of 0.

So a bit later, those two plugins have been changed to make use of a skip expression of '0'. So patch 8.1.115 fixed the matchparen plugin and patch 8.1.143 fixed a related problem with the matchit and matchparen plugin, that should keep Vim responsive, even when the pattern is not found.

If you still see the error, even after you have installed a Vim version later than 8.1.143, that means you most likely have an older matchparen plugin laying around and are not using the latest version that comes with Vim. So make so to update the runtime files properly and delete older plugins in case you have them in your local .vim path as well.

The related issue in the Vim bug tracker is https://github.com/vim/vim/issues/3225

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.