2

I'm having a weird issue in which I can't get parentheses to match in VB files in vim or gvim.

For example, if I start vim and insert Iif(test, 0, 1), I can use % to jump between the two parentheses like normal. Then if I run :set ft=vb, it stops working. Actually, I get one more jump, then it stops working.

I have tested this on two different machines running Windows and Linux and I get the same results.

Does anyone know why this might be?

Kris Harper
  • 5,672
  • 8
  • 51
  • 96

1 Answers1

0

You're using the matchit plugin that comes with Vim. In $VIMRUNTIME/ftplugin/vb.vim, it defines custom pairs (e.g. If...End If) which override the default pairs. To re-enable those (in addition), put the following into ~/.vim/after/ftplugin/vb.vim:

let b:match_words .= ',(:)'

Cp. :help b:match_words.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • First of all, `:help b:match_words` only works if you have installed the help file for matchit. If not, then you can still `:e $VIMRUNTIME/macros/matchit.txt`. Second of all, matchit uses the standard `'matchpairs'` option as well as `b:match_words`. In my little test, `:MatchDebug` cleared up the problem. This seems familiar ... – benjifisher Mar 07 '14 at 20:15
  • 1
    Found it: see my comment on this answer: http://stackoverflow.com/a/13386769/3130080. So something is wrong in how matchit caches its search patterns ... – benjifisher Mar 07 '14 at 20:21