Re: matchit doesn't work for php

2006-07-13 Thread Pete Johns
On Thu, 2006-07-13 at 06:42:43 +0200, Cesar Romani sent:
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

I don't think matchit.vim is to blame here. I have tried your
code with VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 26 2006
20:24:17) with matchit.vim removed and it still misbehaves.

Somewhat surprisingly, though, matchparen.vim is highlighting the
correct braces!

I'm sorry I cannot provide a solution, but hopefully this will
point you in the right direction.


Best wishes;


--paj
-- 
Pete Johns   http://johnsy.com/
Contact Information  http://johnsy.com/contact/
Bothered   http://johnsy.com/20060709100906


pgpMJdEjnEt04.pgp
Description: PGP signature


Re: matchit doesn't work for php

2006-07-13 Thread Benji Fisher
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