On Thu, Jul 13, 2006 at 06:42:43AM +0200, Cesar Romani wrote:
>
> In the following function the bracket at 3 doesn't match the bracket at 17
> And the bracket at 5 doesn't match the bracket at 8
>
> 1 <?php
> 2 function test1($a,$b,$c,$d,$e,$f)
> 3 {
> 4 if($e=='hola')
> 5 {
> 6 if($f=='') $f='1000';
> 7 $s='{'.$d.':'.$f.'}amigo';
> 8 }
> 9 else
> 10 {
> 11 $s='{'.$d.':'.$f.'}amiga';
> 12 }
> 13 $this->s=$s;
> 14 $this->a=$a;
> 15 $this->b=$b;
> 16 $this->c=$c;
> 17 }
> 18 ?>
>
> Many thanks in advance.
>
> Cesar
The problem is that "{" is included in the 'matchpairs' option but
not in b:match_words. The matchit script recognizes that "{" is a
matching character, but does not have a rule for it, so it defaults to
the built-in % matching behavior. You can confirm this with
:normal! %
The solution is to add '{:}' to b:match_words ; probably also '(:)'
and '[:]' while you are at it. Also, I notice that ftplugin/php.vim
:source's ftplugin/html.vim and so inherits the HTML setting of
b:match_skip . I think that PHP would do better with the default skip
behavior, so it should :unlet this variable.
I am cc'ing the maintainer of ftplugin/php.vim .
HTH --Benji Fisher