Benji Fisher wrote:
On Wed, Sep 06, 2006 at 01:20:13AM +0200, A.J.Mechelynck wrote:
It's supposed to treat ? and : on the one hand, and = and ; on the other hand, as "paired brackets". However, the matchparen plugin uses a rather elementary algorithm to split 'matchpairs' into individual items: any colons and commas are regarded as delimiters, and then odd "parts" are treated as "left brackets", even ones as "right brackets".

     Good catch.  I think the line you are referring to is

  let plist = split(&matchpairs, ':\|,')

in $VIMRUNTIME/plugin/matchparen.vim .

I see the following possible cures, use only one of them:
(a) disable matchparen matching

        :set loaded_matchparen = 1

(b) remove the questionable pair "?::" from the 'matchpairs' options

(c) patch plugin/matchparen.vim to refine the splitting algorithm, so that a colon should be treated as either a separator or a "bracket" depending on position within the option.

     Now that the problem has been pointed out, I think the patch should
be made in the official distribution.  How about (simple but oh, so
clever)

  let plist = split(&matchpairs, '.\zs.')

which removes every second character?  Will that have trouble with
multibyte characters?  Are these even allowed in 'matchpairs'?

The help for 'matchparen' mentions only "single characters" which "must be different". You might try it with Arabic "ornate parentheses", U+FD3E (left i.e. closing) and U+FD3F (right i.e.opening), which are obviously meant to pair with each other.

IIUC, a dot in a pattern matches one character, which may be one or more bytes, and which may occupy one screen cell, two for a wide CJK character, one to eight for a tab, etc.


HTH                                     --Benji Fisher

P.S.  cc'ed to vim-dev for further discussion



Best regards,
Tony.

Reply via email to