Monday, May 7, 2012

Re: No ~/.vim/after/syntax/php.vim

On Mon, May 7, 2012 at 5:56 PM, Benjamin R. Haskell <vim@benizi.com> wrote:
>> syn match phpPlusEq '+='
>
>
> It worked for me after changing that line to:
>
> syn match phpPlusEq '+=' containedin=phpOperator
>

Thanks, Ben! I changed the line as you mention, but still no
highlighting of the += operator, even though I can see the file is
being sourced.

I will say, though, that this issue brought my attention to the
operator so forward in my mind that I am much more mindful of it. I
dare say that I may be less prone to making the .= / += mistake now.

The root of the problem is PHP usage of the . operator for string
concatenation, vs. Javascript / Java / C# usage of += for the same.
PHP _does_ use += for integer/float addition, and on top of that PHP
will silently cast a string to an int (value: 0) if the += operator is
used on it, then silently overwrite the weakly-typed variable with the
integer!

TRWFT is PHP.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: