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

Bug in matchparen.vim?

Expand Messages
  • Jeremy Conlin
    I have the latest snapshot of vim7 running on my Intel Mac. I think there is a bug in the matchparen.vim plugin. I have a C++ file and whenever I get to }
    Message 1 of 3 , Mar 14, 2006
    • 0 Attachment
      I have the latest snapshot of vim7 running on my Intel Mac. I think
      there is a bug in the matchparen.vim plugin. I have a C++ file and
      whenever I get to "}" I get the error pasted at the end of this email.
      I get a similar error with parentheses or square brackets and (e.g.
      [{()}]). When I remove the matchparen.vim script from the
      $RUNTIME/plugin directory the error goes away. Is this a bug or is it
      something with my setup?
      Thanks,
      Jeremy

      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 51:
      E15: Invalid expression:
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 51:
      E15: Invalid expression: 'synIDattr(synID(c_lnum, c_col - before, 0), "name") '
      .
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 52:
      E10: \ should be followed by /, ? or &
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 53:
      E121: Undefined variable: s_skip
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 53:
      E15: Invalid expression: s_skip '| let s_skip = 0 | endif'
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 61:
      E121: Undefined variable: s_skip
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 61:
      E116: Invalid arguments for function searchpairpos(c, '', c2, s_flags, s_skip, s
      topline)
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 61:
      E15: Invalid expression: searchpairpos(c, '', c2, s_flags, s_skip, stopline)
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 67:
      E121: Undefined variable: m_lnum
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 67:
      E15: Invalid expression: m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w
      $')
      Press ENTER or type command to continue
      Error detected while processing function <SNR>11_Highlight_Matching_Pair:
      line 69:
      E10: \ should be followed by /, ? or &
      Press ENTER or type command to continue
    • Bram Moolenaar
      ... It looks like you have compatible not set but do have the C flag in cpoptions . A bit strange, but it can happen. If this is the problem then this
      Message 2 of 3 , Mar 14, 2006
      • 0 Attachment
        Jeremy Conlin wrote:

        > I have the latest snapshot of vim7 running on my Intel Mac. I think
        > there is a bug in the matchparen.vim plugin. I have a C++ file and
        > whenever I get to "}" I get the error pasted at the end of this email.
        > I get a similar error with parentheses or square brackets and (e.g.
        > [{()}]). When I remove the matchparen.vim script from the
        > $RUNTIME/plugin directory the error goes away. Is this a bug or is it
        > something with my setup?

        It looks like you have 'compatible' not set but do have the 'C' flag in
        'cpoptions'. A bit strange, but it can happen.

        If this is the problem then this patch should fix it:

        diff -u -r1.5 matchparen.vim
        --- plugin/matchparen.vim 4 Mar 2006 21:48:10 -0000 1.5
        +++ plugin/matchparen.vim 14 Mar 2006 22:06:18 -0000
        @@ -23,6 +23,9 @@
        finish
        endif

        +let cpo_save = &cpo
        +set cpo-=C
        +
        " The function that is invoked (very often) to define a ":match" highlighting
        " for any matching paren.
        function! s:Highlight_Matching_Pair()
        @@ -102,3 +105,5 @@
        " Define commands that will disable and enable the plugin.
        command! NoMatchParen 3match none | unlet! g:loaded_matchparen | au! matchparen
        command! DoMatchParen runtime plugin/matchparen.vim | doau CursorMoved
        +
        +let &cpo = cpo_save

        --
        hundred-and-one symptoms of being an internet addict:
        120. You ask a friend, "What's that big shiny thing?" He says, "It's the sun."

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://www.ICCF.nl ///
      • Jeremy Conlin
        ... You are right that I have compatible set. To my knowledge I have not changed cpoptions, I still don t know exactly what it does but that doesn t matter
        Message 3 of 3 , Mar 15, 2006
        • 0 Attachment
          On 3/14/06, Bram Moolenaar <Bram@...> wrote:
          >
          > Jeremy Conlin wrote:
          >
          > > I have the latest snapshot of vim7 running on my Intel Mac. I think
          > > there is a bug in the matchparen.vim plugin. I have a C++ file and
          > > whenever I get to "}" I get the error pasted at the end of this email.
          > > I get a similar error with parentheses or square brackets and (e.g.
          > > [{()}]). When I remove the matchparen.vim script from the
          > > $RUNTIME/plugin directory the error goes away. Is this a bug or is it
          > > something with my setup?
          >
          > It looks like you have 'compatible' not set but do have the 'C' flag in
          > 'cpoptions'. A bit strange, but it can happen.

          You are right that I have compatible set. To my knowledge I have not
          changed cpoptions, I still don't know exactly what it does but that
          doesn't matter now. I have set nocomptible in my .vimrc file and
          matchparen.vim now works well.
          Thanks,
          Jeremy
        Your message has been successfully submitted and would be delivered to recipients shortly.