Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • sc
    ... 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
    Message 1 of 18 , May 3, 2012
    View Source
    • 0 Attachment
      On Thu, May 03, 2012 at 08:37:19PM +0300, 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
      > scriptencoding utf-8
      > setlocal nolist
      > syn match phpPlusEq '+='
      > hi link phpPlusEq Error
      > " vim: ts=8 sw=2
      > $

      > However, it is not showing in my list of scriptnames:
      > 1: /usr/share/vim/vimrc
      > 2: /usr/share/vim/vim73/debian.vim
      > 3: /usr/share/vim/vim73/syntax/syntax.vim
      > 4: /usr/share/vim/vim73/syntax/synload.vim
      > 5: /usr/share/vim/vim73/syntax/syncolor.vim
      > 6: /usr/share/vim/vim73/filetype.vim
      > 7: /home/dotancohen/.vimrc
      > 8: /home/dotancohen/.vim/keymap/insert-only_capslock.vim
      > 9: /home/dotancohen/.vim/plugin/taglist.vim
      > 10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
      > 11: /usr/share/vim/vim73/plugin/gzip.vim
      > 12: /usr/share/vim/vim73/plugin/matchparen.vim
      > 13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
      > 14: /usr/share/vim/vim73/plugin/rrhelper.vim
      > 15: /usr/share/vim/vim73/plugin/spellfile.vim
      > 16: /usr/share/vim/vim73/plugin/tarPlugin.vim
      > 17: /usr/share/vim/vim73/plugin/tohtml.vim
      > 18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
      > 19: /usr/share/vim/vim73/plugin/zipPlugin.vim
      > 20: /home/dotancohen/.vim/after/plugin/matchparen.vim
      > 21: /usr/share/vim/vim73/scripts.vim
      > Press ENTER or type command to continue

      > 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
      View Source
      • 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
        Message 3 of 18 , May 3, 2012
        View Source
        • 0 Attachment
          On Thursday, May 3, 2012 12:37:19 PM UTC-5, dotancohen 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
          > scriptencoding utf-8
          > setlocal nolist
          > syn match phpPlusEq '+='
          > hi link phpPlusEq Error
          > " vim: ts=8 sw=2
          > $
          >
          > However, it is not showing in my list of scriptnames:
          > 1: /usr/share/vim/vimrc
          > 2: /usr/share/vim/vim73/debian.vim
          > 3: /usr/share/vim/vim73/syntax/syntax.vim
          > 4: /usr/share/vim/vim73/syntax/synload.vim
          > 5: /usr/share/vim/vim73/syntax/syncolor.vim
          > 6: /usr/share/vim/vim73/filetype.vim
          > 7: /home/dotancohen/.vimrc
          > 8: /home/dotancohen/.vim/keymap/insert-only_capslock.vim
          > 9: /home/dotancohen/.vim/plugin/taglist.vim
          > 10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
          > 11: /usr/share/vim/vim73/plugin/gzip.vim
          > 12: /usr/share/vim/vim73/plugin/matchparen.vim
          > 13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
          > 14: /usr/share/vim/vim73/plugin/rrhelper.vim
          > 15: /usr/share/vim/vim73/plugin/spellfile.vim
          > 16: /usr/share/vim/vim73/plugin/tarPlugin.vim
          > 17: /usr/share/vim/vim73/plugin/tohtml.vim
          > 18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
          > 19: /usr/share/vim/vim73/plugin/zipPlugin.vim
          > 20: /home/dotancohen/.vim/after/plugin/matchparen.vim
          > 21: /usr/share/vim/vim73/scripts.vim
          > Press ENTER or type command to continue
          >
          >

          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
          View Source
          • 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.

            --
            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
          • 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
            View Source
            • 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
              Message 6 of 18 , May 3, 2012
              View Source
              • 0 Attachment
                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?

                Thanks.


                --
                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
              • 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
                View Source
                • 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
                  View Source
                  • 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.

                    1: /usr/share/vim/vimrc
                    2: /usr/share/vim/vim73/debian.vim
                    3: /usr/share/vim/vim73/syntax/syntax.vim
                    4: /usr/share/vim/vim73/syntax/synload.vim
                    5: /usr/share/vim/vim73/syntax/syncolor.vim
                    6: /usr/share/vim/vim73/filetype.vim
                    7: /home/dotancohen/.vimrc
                    8: /home/dotancohen/.vim/keymap/insert-only_capslock.vim
                    9: /home/dotancohen/.vim/plugin/taglist.vim
                    10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
                    11: /usr/share/vim/vim73/plugin/gzip.vim
                    12: /usr/share/vim/vim73/plugin/matchparen.vim
                    13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
                    14: /usr/share/vim/vim73/plugin/rrhelper.vim
                    15: /usr/share/vim/vim73/plugin/spellfile.vim
                    16: /usr/share/vim/vim73/plugin/tarPlugin.vim
                    17: /usr/share/vim/vim73/plugin/tohtml.vim
                    18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
                    19: /usr/share/vim/vim73/plugin/zipPlugin.vim
                    20: /home/dotancohen/.vim/after/plugin/matchparen.vim
                    21: /usr/share/vim/vim73/scripts.vim
                    Press ENTER or type command to continue

                    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
                    View Source
                    • 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.

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

                      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:

                      http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_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
                      View Source
                      • 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?

                        >
                        > 3: /usr/share/vim/vim73/syntax/syntax.vim
                        > 6: /usr/share/vim/vim73/filetype.vim

                        --
                        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
                        ... Yes, of course they are. Trying to do too many things at once and thought I read something else. Sorry for the noise. Regards, Gary -- You received this
                        Message 11 of 18 , May 3, 2012
                        View Source
                        • 0 Attachment
                          On 2012-05-03, Ben Fritz wrote:
                          > 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?

                          Yes, of course they are. Trying to do too many things at once and
                          thought I read something else. Sorry for the noise.

                          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
                        • Dotan Cohen
                          On Thu, May 3, 2012 at 11:14 PM, Charles Campbell ... Thanks, it is in fact php . -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- You
                          Message 12 of 18 , May 3, 2012
                          View Source
                          • 0 Attachment
                            On Thu, May 3, 2012 at 11:14 PM, Charles Campbell
                            > :echo b:current_syntax
                            >

                            Thanks, it is in fact "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
                          • Dotan Cohen
                            ... Apparently I erred, I apologise for driving everyone crazy. Here is the :scriptfiles output for a PHP file: 1: /usr/share/vim/vimrc 2:
                            Message 13 of 18 , May 3, 2012
                            View Source
                            • 0 Attachment
                              On Thu, May 3, 2012 at 11:49 PM, Gary Johnson <garyjohn@...> wrote:
                              > 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.
                              >
                              >      1: /usr/share/vim/vimrc
                              >      2: /usr/share/vim/vim73/debian.vim
                              >      3: /usr/share/vim/vim73/syntax/syntax.vim
                              >      4: /usr/share/vim/vim73/syntax/synload.vim
                              >      5: /usr/share/vim/vim73/syntax/syncolor.vim
                              >      6: /usr/share/vim/vim73/filetype.vim
                              >      7: /home/dotancohen/.vimrc
                              >      8: /home/dotancohen/.vim/keymap/insert-only_capslock.vim
                              >      9: /home/dotancohen/.vim/plugin/taglist.vim
                              >     10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
                              >     11: /usr/share/vim/vim73/plugin/gzip.vim
                              >     12: /usr/share/vim/vim73/plugin/matchparen.vim
                              >     13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
                              >     14: /usr/share/vim/vim73/plugin/rrhelper.vim
                              >     15: /usr/share/vim/vim73/plugin/spellfile.vim
                              >     16: /usr/share/vim/vim73/plugin/tarPlugin.vim
                              >     17: /usr/share/vim/vim73/plugin/tohtml.vim
                              >     18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
                              >     19: /usr/share/vim/vim73/plugin/zipPlugin.vim
                              >     20: /home/dotancohen/.vim/after/plugin/matchparen.vim
                              >     21: /usr/share/vim/vim73/scripts.vim
                              >    Press ENTER or type command to continue
                              >
                              > 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.
                              >

                              Apparently I erred, I apologise for driving everyone crazy. Here is
                              the :scriptfiles output for a PHP file:

                              1: /usr/share/vim/vimrc
                              2: /usr/share/vim/vim73/debian.vim
                              3: /usr/share/vim/vim73/syntax/syntax.vim
                              4: /usr/share/vim/vim73/syntax/synload.vim
                              5: /usr/share/vim/vim73/syntax/syncolor.vim
                              6: /usr/share/vim/vim73/filetype.vim
                              7: /home/dotancohen/.vimrc
                              8: /home/dotancohen/.vim/keymap/insert-only_capslock.vim
                              9: /home/dotancohen/.vim/plugin/taglist.vim
                              10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
                              11: /usr/share/vim/vim73/plugin/gzip.vim
                              12: /usr/share/vim/vim73/plugin/matchparen.vim
                              13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
                              14: /usr/share/vim/vim73/plugin/rrhelper.vim
                              15: /usr/share/vim/vim73/plugin/spellfile.vim
                              16: /usr/share/vim/vim73/plugin/tarPlugin.vim
                              17: /usr/share/vim/vim73/plugin/tohtml.vim
                              18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
                              19: /usr/share/vim/vim73/plugin/zipPlugin.vim
                              20: /home/dotancohen/.vim/after/plugin/matchparen.vim
                              21: /usr/share/vim/vim73/syntax/php.vim
                              22: /usr/share/vim/vim73/syntax/html.vim
                              23: /usr/share/vim/vim73/syntax/javascript.vim
                              24: /usr/share/vim/vim73/syntax/vb.vim
                              25: /usr/share/vim/vim73/syntax/css.vim
                              26: /usr/share/vim/vim73/syntax/sql.vim
                              27: /usr/share/vim/vim73/syntax/sqloracle.vim
                              28: /home/dotancohen/.vim/after/syntax/php.vim
                              29: /usr/share/vim/vim73/scripts.vim
                              30: /usr/share/vim/vim73/syntax/help.vim

                              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

                              --
                              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
                            • sc
                              ... in your original post you said ... is it possible you have similarly fat-fingered the operator in your script? sc -- You received this
                              Message 14 of 18 , May 4, 2012
                              View Source
                              • 0 Attachment
                                On Fri, May 04, 2012 at 09:34:23AM +0300, Dotan Cohen wrote:
                                > On Thu, May 3, 2012 at 11:49 PM, Gary Johnson <garyjohn@...> wrote:
                                > > On 2012-05-03, Dotan Cohen wrote:
                                > >> On Thu, May 3, 2012 at 10:34 PM, Ben Fritz 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?

                                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
                              • Dotan Cohen
                                ... 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
                                Message 15 of 18 , May 4, 2012
                                View Source
                                • 0 Attachment
                                  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 '+='
                                  hi link phpPlusEq Error

                                  Version 2:
                                  scriptencoding utf-8
                                  setlocal nolist
                                  syn keyword phpPlusEq +=
                                  highlight phpPlusEq term=reverse ctermfg=black ctermbg=yellow
                                  guifg=black guibg=yellow


                                  --
                                  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
                                • 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
                                  View Source
                                  • 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,
                                    Message 17 of 18 , May 7, 2012
                                    View Source
                                    • 0 Attachment
                                      On Mon, May 7, 2012 at 5:56 PM, Benjamin R. Haskell <vim@...> 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
                                    Your message has been successfully submitted and would be delivered to recipients shortly.