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

Re: bug in showmatch

Expand Messages
  • Benji Fisher
    ... I think that showmatch behaves like the built-in %. According to :help % ... There is no mention of ignoring parens in comments. If you want % to deal
    Message 1 of 2 , May 2, 2003
    • 0 Attachment
      Michael P. Soulier wrote:
      > People,
      >
      > I was just using a big block of perl, and showmatch failed as long
      > as there was a comment across the match.
      >
      > ie.
      >
      > print $q->table({-width => '100%'},
      > $q->Tr($q->th({-class => 'sme-layout'},
      > $q->a( { -href => "viewlogfiles?page=0&Next=viewLog" .
      > #$q->submit(-value => "Refresh"))));
      > "&filename=$filename&matchPattern=$matchPattern" .
      > "&highlightPattern=$highlightPattern" },
      > "Refresh"))));
      >
      > With the comment present, showmatch did not work as I closed the parens
      > below the comment. It was fine once I moved the commented line.

      I think that 'showmatch' behaves like the built-in %. According to :help %

      > Parens and braces preceded with a backslash are
      > ignored. When the '%' character is not present in
      > 'cpoptions', parens and braces inside double quotes
      > are ignored, unless the number of parens/braces in a
      > line is uneven and this line and the previous one does
      > not end in a backslash. '(', '{', '[', ']', '}' and
      > ')' are also ignored (parens and braces inside single
      > quotes). Note that this works fine for C, but not for
      > Perl, where single quotes are used for strings.

      There is no mention of ignoring parens in comments. If you want % to deal
      intelligently, you can use $VIMRUNTIME/matchit.vim (recommended), although that
      is potentially slower than the default %. Then you can

      :set noshowmatch
      :imap ) )<C-\><C-N>%:sleep 100m<CR>%a

      and similarly for ] and } and ... If you want to be fancy, use the value of
      'matchtime' instead of 100m. Problem: this will get distracting if the opening
      paren is not on the screen (shudder).

      HTH --Benji Fisher
    Your message has been successfully submitted and would be delivered to recipients shortly.