> Why might that be? This is on Kubuntu 11.10, KDE 4.7 with VIM 7.3. My
> ~/.vim/after/plugin/matchparen.vim file works as expected, so it seems
> that the "after" files are supported.

the first obvious question is: does vim recognize the filetype
of whatever you are editing as 'php'?

sc

--
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

Benjamin R. Haskell

... Your ~/.vim/after/plugin/matchparen.vim was run after the plugin/matchparen.vim from $VIMRUNTIME. (Plugins are loaded when Vim is starting up.) Similarly,

Message 2 of 18
, May 3, 2012

0 Attachment

On Thu, 3 May 2012, Dotan Cohen wrote:

> I am trying to get the "=+" operator highlighted as an error in PHP
> files. I have this file:
> $ cat /home/dotancohen/.vim/after/syntax/php.vim
> [...]
>
> However, it is not showing in my list of scriptnames:
> [...]
> 12: /usr/share/vim/vim73/plugin/matchparen.vim
> [...]
> 20: /home/dotancohen/.vim/after/plugin/matchparen.vim
> [...]
>
> Why might that be? This is on Kubuntu 11.10, KDE 4.7 with VIM 7.3. My
> ~/.vim/after/plugin/matchparen.vim file works as expected, so it seems
> that the "after" files are supported.

Your ~/.vim/after/plugin/matchparen.vim was run after the
plugin/matchparen.vim from $VIMRUNTIME. (Plugins are loaded when Vim is
starting up.)

Similarly, your ~/.vim/after/syntax/php.vim will be run after the
syntax/php.vim from $VIMRUNTIME. (Syntax files are loaded as-needed.)

So, it won't show up in :scriptnames until you open a PHP file.

--
Best,
Ben

--
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

Ben Fritz

... I also do not see a syntax/php.vim or a ftplugin/php.vim in the list anywhere. It looks like you either don t have filetype detection turned on, you don t

I also do not see a syntax/php.vim or a ftplugin/php.vim in the list anywhere. It looks like you either don't have filetype detection turned on, you don't have syntax highlighting turned on, you aren't editing a file of type php, or you are editing such a file but Vim's filetype detection mechanisms did not realize it.

--
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

Dotan Cohen

... I can confirm that the file is named someFile.php and that other PHP code in the file is in fact highlighted. For instance, someVar is not highlighted

Message 4 of 18
, May 3, 2012

0 Attachment

> the first obvious question is: does vim recognize the filetype
> of whatever you are editing as 'php'?
>

I can confirm that the file is named someFile.php and that other PHP
code in the file is in fact highlighted. For instance, "someVar" is
not highlighted whereas "$someVar" is highlighted. Likewise, strblah()
is not highlighted whereas strlen() is highlighted. So it looks like
PHP-specific highlighting to me.

--
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

Ben Fritz

... It shouldn t, without a syntax/php.vim file somewhere. As noted, this file is only sourced as-needed; is the output of the :scriptnames command you gave

Message 5 of 18
, May 3, 2012

0 Attachment

On Thursday, May 3, 2012 2:15:57 PM UTC-5, dotancohen wrote:

> > the first obvious question is: does vim recognize the filetype
> > of whatever you are editing as 'php'?
> >
>
> I can confirm that the file is named someFile.php and that other PHP
> code in the file is in fact highlighted. For instance, "someVar" is
> not highlighted whereas "$someVar" is highlighted. Likewise, strblah()
> is not highlighted whereas strlen() is highlighted. So it looks like
> PHP-specific highlighting to me.
>

It shouldn't, without a syntax/php.vim file somewhere. As noted, this file is only sourced as-needed; is the output of the :scriptnames command you gave from a Vim with the php file loaded and syntax highlighting on as you describe? In that Vim, what does this command say?

:verbose set syntax? filetype?

And what is the value of b:current_syntax?

--
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

Dotan Cohen

... The PHP syntax is probably being sourced from whatever the default is in /etc or /usr ... syntax=php Last set from /usr/share/vim/vim73/syntax/syntax.vim

> It shouldn't, without a syntax/php.vim file somewhere. As noted, this file is only sourced as-needed; is the output of the :scriptnames command you gave from a Vim with the php file loaded and syntax highlighting on as you describe? In that Vim, what does this command say?
>

The PHP syntax is probably being sourced from whatever the default is
in /etc or /usr

> :verbose set syntax? filetype?
>

syntax=php
Last set from /usr/share/vim/vim73/syntax/syntax.vim
filetype=php
Last set from /usr/share/vim/vim73/filetype.vim

> And what is the value of b:current_syntax?
>

I'm not sure what you mean by that. What command exactly should I be running?

--
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

Charles Campbell

... Chip -- 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,

Message 7 of 18
, May 3, 2012

0 Attachment

Dotan Cohen wrote:

> On Thu, May 3, 2012 at 10:34 PM, Ben Fritz<fritzophrenic@...> wrote:
>
>> It shouldn't, without a syntax/php.vim file somewhere. As noted, this file is only sourced as-needed; is the output of the :scriptnames command you gave from a Vim with the php file loaded and syntax highlighting on as you describe? In that Vim, what does this command say?
>>
>>
> The PHP syntax is probably being sourced from whatever the default is
> in /etc or /usr
>
>
>> :verbose set syntax? filetype?
>>
>>
> syntax=php
> Last set from /usr/share/vim/vim73/syntax/syntax.vim
> filetype=php
> Last set from /usr/share/vim/vim73/filetype.vim
>
>
>
>> And what is the value of b:current_syntax?
>>
>>
> I'm not sure what you mean by that. What command exactly should I be running?
>

:echo b:current_syntax

Chip

--
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

Gary Johnson

... Neither of those files was in the :scriptnames output that you posted originally. 1: /usr/share/vim/vimrc 2: /usr/share/vim/vim73/debian.vim 3:

Message 8 of 18
, May 3, 2012

0 Attachment

On 2012-05-03, Dotan Cohen wrote:

> On Thu, May 3, 2012 at 10:34 PM, Ben Fritz wrote:
> > It shouldn't, without a syntax/php.vim file somewhere. As noted,
> > this file is only sourced as-needed; is the output of the
> > :scriptnames command you gave from a Vim with the php file
> > loaded and syntax highlighting on as you describe? In that Vim,
> > what does this command say?
> >
>
> The PHP syntax is probably being sourced from whatever the default is
> in /etc or /usr
>
> > :verbose set syntax? filetype?
> >
>
> syntax=php
> Last set from /usr/share/vim/vim73/syntax/syntax.vim
> filetype=php
> Last set from /usr/share/vim/vim73/filetype.vim

Neither of those files was in the :scriptnames output that you
posted originally.

That means that they were sourced AFTER you executed that
:scriptnames command but BEFORE you executed

:verbose set syntax? filetype?

So try the :scriptnames command again but this time AFTER you open a
PHP file.

Regards,
Gary

--
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

Ben Fritz

... But, it ISN T being sourced. If php syntax is on, then you should see a syntax/php.vim file in your :scriptnames output, which you do not. ... Ok, so you

Message 9 of 18
, May 3, 2012

0 Attachment

On Thursday, May 3, 2012 3:00:09 PM UTC-5, dotancohen wrote:

> On Thu, May 3, 2012 at 10:34 PM, Ben Fritz <fritzophrenic@...> wrote:
> > It shouldn't, without a syntax/php.vim file somewhere. As noted, this file is only sourced as-needed; is the output of the :scriptnames command you gave from a Vim with the php file loaded and syntax highlighting on as you describe? In that Vim, what does this command say?
> >
>
> The PHP syntax is probably being sourced from whatever the default is
> in /etc or /usr
>

But, it ISN'T being sourced. If php syntax is on, then you should see a syntax/php.vim file in your :scriptnames output, which you do not.

Ok, so you have a correctly set filetype and syntax. But somehow syntax/php.vim never got sourced. What does ":verbose set runtimepath?" say? Is your expected after directory on that path? Also, is there a directory on that path which includes a syntax directory which also includes a php.vim file? I'm baffled how you have php syntax highlighting if no php syntax definitions have been loaded. Try using this to see what highlight group is under the cursor:

and then use :verbose hi NameOfHighlightGroupUnderCursor to see where it was set.

> > And what is the value of b:current_syntax?
> >
>
> I'm not sure what you mean by that. What command exactly should I be running?
>

As suggested by somebody else, either of these will work:

:echo b:current_syntax
:let b:current_syntax

--
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

Ben Fritz

... Yes, they are. I guess the :verbose didn t give anything useful here, unfortunately. I m baffled how syntax and filetype are set but the file isn t being

Message 10 of 18
, May 3, 2012

0 Attachment

On Thursday, May 3, 2012 3:49:03 PM UTC-5, Gary Johnson wrote:

> >
> > syntax=php
> > Last set from /usr/share/vim/vim73/syntax/syntax.vim
> > filetype=php
> > Last set from /usr/share/vim/vim73/filetype.vim
>
> Neither of those files was in the :scriptnames output that you
> posted originally.

Yes, they are. I guess the :verbose didn't give anything useful here, unfortunately. I'm baffled how syntax and filetype are set but the file isn't being sourced. Maybe his config is missing a "syntax on" command?

I see that ~/.vim/after/syntax/php.vim is in there. However, the +=
string is certainly not being highlighted as error. Here is the
content of the ~/.vim/after/syntax/php.vim file:
scriptencoding utf-8
setlocal nolist
syn match phpPlusEq '+='
hi link phpPlusEq Error

I also tried with a keyword definition instead of match, this did not
work to highlight += either:
scriptencoding utf-8
setlocal nolist
syn keyword phpPlusEq +=
highlight phpPlusEq term=reverse ctermfg=black ctermbg=yellow
guifg=black guibg=yellow

> <rapacious snip>
>
> in your original post you said
>
>> I am trying to get the "=+" operator highlighted as an error in PHP
>
> is it possible you have similarly fat-fingered the operator in
> your script?
>

Nice catch! I just double checked, no fat fingers in either of the two
scripts that I am trying on the assumption that there may be a problem
in the script:

--
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

Benjamin R. Haskell

... It worked for me after changing that line to: syn match phpPlusEq += containedin=phpOperator ... -- Best, Ben -- You received this message from the

Message 16 of 18
, May 7, 2012

0 Attachment

On Sat, 5 May 2012, Dotan Cohen wrote:

> On Fri, May 4, 2012 at 8:40 PM, sc <toothpik@...> wrote:
>> <rapacious snip>
>>
>> in your original post you said
>>
>>> I am trying to get the "=+" operator highlighted as an error in PHP
>>
>> is it possible you have similarly fat-fingered the operator in your
>> script?
>>
>
> Nice catch! I just double checked, no fat fingers in either of the two
> scripts that I am trying on the assumption that there may be a problem
> in the script:
>
> Version 1:
> scriptencoding utf-8
> setlocal nolist
> syn match phpPlusEq '+='

It worked for me after changing that line to:

syn match phpPlusEq '+=' containedin=phpOperator

> hi link phpPlusEq Error

--
Best,
Ben

--
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

Dotan Cohen

... 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,

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!