On Fri, Jul 14, 2006 at 04:16:44AM +0200, Cesar Romani wrote: > > Thanks a lot, it works but I also notice that "else if" is not part of the > matching, although "else if" is a valid expression in php: > It matches if, else, elseif > but it doesn't match if, else, else if > How can I include "else if" in the matching? > Many thanks in advance. > > Cesar
First of all, it is not clear to me that everyone would want to treat "else if" the same as "elseif". From the PHP manual, In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (if you're familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior. Personally, I would use "elseif" for something like the example given there, if ($a > $b) { echo "a is bigger than b"; } elseif ($a == $b) { echo "a is equal to b"; } else { echo "a is smaller than b"; } but I might write "else if" for something like if ($a > $b) { echo "a is bigger than b"; } else if ($a == $b) { # This is the complicated case! # Many lines of code } else { echo "a is smaller than b"; } and then I would be annoyed if "else if" were treated the same as "elseif". If you still want to treat them the same, then replace 'elseif' in the matchit patterns with 'else\s*if'. Then test it: you should get different results depending on whether you start with the cursor on the first or second word of "else if", and you may like it. If you really want the two cases treated identically, then you have to make sure that the second part of "else if" is not treated as an "if", so replace '\<if' in the matching patterns with '\%(\<else\s*\)\@<!\<if' (untested). That should do it. if (help for matchit not yet installed) :help matchit-install :help matchit-spaces HTH --Benji Fisher