Whenever I have to do things like this: closeparens = ")]}" or /[)\]}]/ it messes up the parenthesis tracking of the whole file. I could mitigate this with comments:

# complement to ([{ (this is not at all to help with vim's highlighting)
local closeparens="}])"

# don't mind me, just gonna put these here: (((
case $X in
   a) echo 1 ;;
   b) echo 2 ;;
   c) echo 3 ;;

But I'd rather not modify my code because of my text editor.

How would I go about configuring this? No need for an easy answer, if I have to modify the gosh darned source code of vim I will. Just any sort of pointer on where to start would be nice.


1 Answer 1


You are looking for matchit-zip

The matchit.vim script allows you to configure % to match more than just single characters. You can match words and even regular expressions. Also, matching treats strings and comments (as recognized by the syntax highlighting mechanism) intelligently.


Since vim 6.0, matchit.vim has been included in the standard vim distribution, under the macros/ directory

but IMO it's easier to install the plugin linked above.

  • I was already in the process of cooking up my own solution, but this is probably the one that is going to be the most useful for most people. I am going to see how convoluted/geared too much towards my own workflow this gets, and if it's too much I will accept your answer (prolly gonna happen). Thank you for your time :)
    – phicr
    Commented Mar 2, 2017 at 23:38
  • I was in the middle of implementing my solution, and as soon as a SQL database came into the mix I immediately decided to come here and accept your answer ;P
    – phicr
    Commented Mar 4, 2017 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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