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

matchpairs and Unicode

Expand Messages
  • KamilS
    The help for matchpairs says “Currently only single byte character pairs are allowed”. Is there any way to work around this? Or any hope that support for
    Message 1 of 15 , Dec 8, 2012
    • 0 Attachment
      The help for 'matchpairs' says “Currently only single byte character pairs are allowed”. Is there any way to work around this? Or any hope that support for Unicode will be added in the foreseeable future?

      I’d very much like to have matching for different kinds of quotes, especially ‘’. I tried different plugins, such as ‘surround’ and others, but neither seems to works with Unicode characters.

      --
      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
    • Tony Mechelynck
      ... Unless you are willing (and feel capable) to write the necessary patch for the Vim C code, my guess is not any time soon . Just a guess, of course, and
      Message 2 of 15 , Dec 8, 2012
      • 0 Attachment
        On 08/12/12 16:48, KamilS wrote:
        > The help for 'matchpairs' says “Currently only single byte character pairs are allowed”. Is there any way to work around this? Or any hope that support for Unicode will be added in the foreseeable future?
        >
        > I’d very much like to have matching for different kinds of quotes, especially ‘’. I tried different plugins, such as ‘surround’ and others, but neither seems to works with Unicode characters.
        >

        Unless you are willing (and feel capable) to write the necessary patch
        for the Vim C code, my guess is "not any time soon".

        Just a guess, of course, and I've often guessed wrong.


        Best regards,
        Tony.
        --
        ARTHUR: But if he was dying, he wouldn't bother to carve
        "Aaaaarrrrrrggghhh". He'd just say it.
        BROTHER MAYNARD: It's down there carved in stone.
        GALAHAD: Perhaps he was dictating.
        "Monty Python and the Holy Grail" PYTHON (MONTY)
        PICTURES LTD

        --
        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
      • Christian Brabandt
        Hi Tony! ... I think the matchit plugin should be able to cope with multibyte chars. regars, Christian -- You received this message from the vim_use
        Message 3 of 15 , Dec 9, 2012
        • 0 Attachment
          Hi Tony!

          On So, 09 Dez 2012, Tony Mechelynck wrote:

          > On 08/12/12 16:48, KamilS wrote:
          > >The help for 'matchpairs' says “Currently only single byte character pairs are allowed”. Is there any way to work around this? Or any hope that support for Unicode will be added in the foreseeable future?
          > >
          > >I’d very much like to have matching for different kinds of quotes, especially ‘’. I tried different plugins, such as ‘surround’ and others, but neither seems to works with Unicode characters.
          > >
          >
          > Unless you are willing (and feel capable) to write the necessary
          > patch for the Vim C code, my guess is "not any time soon".
          >
          > Just a guess, of course, and I've often guessed wrong.

          I think the matchit plugin should be able to cope with multibyte chars.

          regars,
          Christian

          --
          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
        • KamilS
          Thank you for the answers. As for being able to write the appropriate patch, well, I m afraid I m not. I wish I could, but no. As for matchit, thanks for the
          Message 4 of 15 , Dec 9, 2012
          • 0 Attachment
            Thank you for the answers.

            As for being able to write the appropriate patch, well, I'm afraid I'm not. I wish I could, but no.

            As for matchit, thanks for the tip, but I don't seem to be able to find the option to highlight the matched pairs in it, just to jump between them, and this isn't quite what I want, unfortunately. Or am I overlooking something?

            --
            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
          • Christian Brabandt
            Hi KamilS! ... By the way, what kind of multibyte characters do you need? regards, Christian -- Zitate in Büchern sind weniger präsent als Zitate in den
            Message 5 of 15 , Dec 25, 2012
            • 0 Attachment
              Hi KamilS!

              On So, 09 Dez 2012, KamilS wrote:

              > Thank you for the answers.
              >
              > As for being able to write the appropriate patch, well, I'm afraid I'm not. I wish I could, but no.
              >
              > As for matchit, thanks for the tip, but I don't seem to be able to find the option to highlight the matched pairs in it, just to jump between them, and this isn't quite what I want, unfortunately. Or am I overlooking something?

              By the way, what kind of multibyte characters do you need?

              regards,
              Christian
              --
              Zitate in Büchern sind weniger präsent als Zitate in den
              Köpfen der Menschen.
              -- Benjamin Stramke

              --
              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
            • KamilS
              ... The pair I need most is ‘’ (U+2018 and U+2019). Other quotes, such as “” would make a nice addition but I won t be turning my nose up should this
              Message 6 of 15 , Dec 25, 2012
              • 0 Attachment
                > By the way, what kind of multibyte characters do you need?

                The pair I need most is ‘’ (U+2018 and U+2019). Other quotes, such as “” would make a nice addition but I won't be turning my nose up should this prove impossible.

                --
                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
              • Tony Mechelynck
                ... Hm, let s see… Anything above 0x7F is 2 or more bytes in UTF-8… For Latin, Cyrillic, etc.: « (U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK) and »
                Message 7 of 15 , Dec 25, 2012
                • 0 Attachment
                  On 25/12/12 23:11, Christian Brabandt wrote:
                  >
                  > By the way, what kind of multibyte characters do you need?
                  >
                  > regards,
                  > Christian
                  >
                  Hm, let's see… Anything above 0x7F is 2 or more bytes in UTF-8…

                  For Latin, Cyrillic, etc.:
                  « (U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK) and » (U+00BB
                  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK)
                  “ (U+201C LEFT DOUBLE QUOTATION MARK) and either ” (U+201D RIGHT DOUBLE
                  QUOTATION MARK) or „ (U+201E DOUBLE LOW-9 QUOTATION MARK)
                  ‘ (U+2018 LEFT SINGLE QUOTATION MARK) and either ’ (U+2019 RIGHT SINGLE
                  QUOTATION MARK) or ‚ (U+201A SINGLE LOW-9 QUOTATION MARK)
                  Depending on the language, two characters on each of the above lines may
                  be chosen, and in either order.

                  In addition, for Spanish:
                  ¡ (U+00A1 INVERTED EXCLAMATION MARK) and ! (U+0021 EXCLAMATION MARK)
                  ¿ (U+00BF INVERTED QUESTION MARK) and ? (U+003F QUESTION MARK)
                  In each of these two pairs, only the first member is multi-byte.

                  For Arabic etc.:
                  ﴿ (U+FD3F ORNATE RIGHT PARENTHESIS) and ﴾ (U+FD3E ORNATE LEFT PARENTHESIS)

                  For CJK:
                  〈 (U+3008 LEFT ANGLE BRACKET) and 〉 (U+3009 RIGHT ANGLE BRACKET)
                  《 (U+300A LEFT DOUBLE ANGLE BRACKET) and 》 (U+300B RIGHT DOUBLE ANGLE
                  BRACKET)
                  「 (U+300C LEFT CORNER BRACKET) and 」 (U+300D RIGHT CORNER BRACKET)
                  『 (U+300E LEFT WHITE CORNER BRACKET) and 』 (U+300F RIGHT WHITE CORNER
                  BRACKET)
                  【 (U+3010 LEFT BLACK LENTICULAR BRACKET) and 】 (U+3011 RIGHT BLACK
                  LENTICULAR BRACKET)
                  〔 (U+3014 LEFT TORTOISE SHELL BRACKET) and 〕 (U+3015 RIGHT TORTOISE
                  SHELL BRACKET)
                  〖 (U+3016 LEFT WHITE LENTICULAR BRACKET) and 〗 (U+3017 RIGHT WHITE
                  LENTICULAR BRACKET)
                  〘 (U+3018 LEFT WHITE TORTOISE SHELL BRACKET) and 〙 (U+3019 RIGHT WHITE
                  TORTOISE SHELL BRACKET)
                  〚 (U+301A LEFT WHITE SQUARE BRACKET) and 〛 (U+301B RIGHT WHITE SQUARE
                  BRACKET)
                  〝 (U+301D REVERSED DOUBLE PRIME QUOTATION MARK) with either 〞 (U+301E
                  DOUBLE PRIME QUOTATION MARK) or (preferred) 〟 (U+301F LOW DOUBLE PRIME
                  QUOTATION MARK)

                  …these are the ones I know about; there may be others.


                  Best regards,
                  Tony.
                  --
                  A triangle which has an angle of 135 degrees is called an obscene
                  triangle.


                  --
                  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
                • KamilS
                  ... I m afraid my Vim says: E474: Invalid argument: matchpairs+=‘:’ `: and other ASCII combinations work fine. It is compiled with +multi_byte. -- You
                  Message 8 of 15 , Dec 25, 2012
                  • 0 Attachment
                    > ‘ (U+2018 LEFT SINGLE QUOTATION MARK) and either ’ (U+2019 RIGHT SINGLE
                    >
                    > Depending on the language, two characters on each of the above lines may
                    > be chosen, and in either order.

                    I'm afraid my Vim says:
                    E474: Invalid argument: matchpairs+=‘:’

                    `:' and other ASCII combinations work fine. It is compiled with +multi_byte.

                    --
                    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
                  • Tony Mechelynck
                    ... Yes, that is expected. My post was in answer to the question which multibyte characters do you need? . As was mentioned earlier in this thread, and is
                    Message 9 of 15 , Dec 25, 2012
                    • 0 Attachment
                      On 26/12/12 00:50, KamilS wrote:
                      >> ‘ (U+2018 LEFT SINGLE QUOTATION MARK) and either ’ (U+2019 RIGHT SINGLE
                      >>
                      >> Depending on the language, two characters on each of the above lines may
                      >> be chosen, and in either order.
                      >
                      > I'm afraid my Vim says:
                      > E474: Invalid argument: matchpairs+=‘:’
                      >
                      > `:' and other ASCII combinations work fine. It is compiled with +multi_byte.
                      >

                      Yes, that is expected.

                      My post was in answer to the question "which multibyte characters do you
                      need?". As was mentioned earlier in this thread, and is documented under
                      ":help 'matchpairs'", "Currently only single byte character pairs are
                      allowed, and they must be different." Without +multi-byte, any character
                      is single-byte but there are only 256 of them at most. With +multi_byte
                      and 'encoding' set to "utf-8", there are only 128 single-byte characters
                      (minus 32 control characters) but there are more than one million
                      characters in all.

                      The OP answered with only one pair, but I suppose that this is an
                      all-or-none question: if a possible *future* patch to the Vim C code
                      allows matching U+201C with U+201D, any other pair of (different)
                      characters (single-byte or not) in the current 'encoding' would be
                      acceptable too.


                      Best regards,
                      Tony.
                      --
                      Haggis, n.:
                      Haggis is a kind of stuff black pudding eaten by the Scots and
                      considered by them to be not only a delicacy but fit for human
                      consumption. The minced heart, liver and lungs of a sheep, calf or
                      other animal's inner organs are mixed with oatmeal, sealed and boiled
                      in maw in the sheep's intestinal stomach-bag and ... Excuse me a minute ...

                      --
                      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
                    • Christian Brabandt
                      Hi Tony! ... Thanks. If I have some spare time, I ll look into enhancing the matchpairs option. Mit freundlichen Grüßen Christian -- Wo man die
                      Message 10 of 15 , Dec 26, 2012
                      • 0 Attachment
                        Hi Tony!

                        On Mi, 26 Dez 2012, Tony Mechelynck wrote:

                        > On 25/12/12 23:11, Christian Brabandt wrote:
                        > >
                        > >By the way, what kind of multibyte characters do you need?
                        > >
                        > Hm, let's see… Anything above 0x7F is 2 or more bytes in UTF-8…

                        Thanks. If I have some spare time, I'll look into enhancing the
                        'matchpairs' option.

                        Mit freundlichen Grüßen
                        Christian
                        --
                        Wo man die Liberalität aber suchen muss, das ist in den
                        Gesinnungen, und diese sind das lebendige Gemüt.
                        -- Goethe, Maximen und Reflektionen, Nr. 355

                        --
                        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
                      • KamilS
                        ... This is fantastic, thanks a lot! -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying
                        Message 11 of 15 , Dec 27, 2012
                        • 0 Attachment
                          > Thanks. If I have some spare time, I'll look into enhancing the
                          > 'matchpairs' option.

                          This is fantastic, thanks a lot!

                          --
                          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
                        • Christian Brabandt
                          Hi ... Bram, here is a patch to make the matchpairs setting multibyte aware. regards, Christian -- Bei ARD und ZDF reihern Sie in den 1. Sitzen. -- You
                          Message 12 of 15 , Dec 29, 2012
                          • 0 Attachment
                            Hi

                            On Do, 27 Dez 2012, KamilS wrote:

                            > > Thanks. If I have some spare time, I'll look into enhancing the
                            > > 'matchpairs' option.
                            >
                            > This is fantastic, thanks a lot!

                            Bram,
                            here is a patch to make the matchpairs setting multibyte aware.

                            regards,
                            Christian
                            --
                            Bei ARD und ZDF reihern Sie in den 1. Sitzen.

                            --
                            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
                          • KamilS
                            ... Thank so much, Christian! -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to.
                            Message 13 of 15 , Jan 1, 2013
                            • 0 Attachment
                              > here is a patch to make the matchpairs setting multibyte aware.

                              Thank so much, Christian!

                              --
                              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
                            • Bram Moolenaar
                              ... Great, thanks! -- hundred-and-one symptoms of being an internet addict: 226. You sit down at the computer right after dinner and your spouse says See you
                              Message 14 of 15 , Jan 2, 2013
                              • 0 Attachment
                                Christian Brabandt wrote:

                                > On Do, 27 Dez 2012, KamilS wrote:
                                >
                                > > > Thanks. If I have some spare time, I'll look into enhancing the
                                > > > 'matchpairs' option.
                                > >
                                > > This is fantastic, thanks a lot!
                                >
                                > Bram,
                                > here is a patch to make the matchpairs setting multibyte aware.

                                Great, thanks!

                                --
                                hundred-and-one symptoms of being an internet addict:
                                226. You sit down at the computer right after dinner and your spouse
                                says "See you in the morning."

                                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                --
                                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
                              • Christian Brabandt
                                Hi ... Updated patch, now also works for non multi-byte builts. regards, Christian -- Aus einer Menge von unordentlichen Strichen bildet man sich leicht eine
                                Message 15 of 15 , Jan 3, 2013
                                • 0 Attachment
                                  Hi

                                  On So, 30 Dez 2012, Christian Brabandt wrote:

                                  > here is a patch to make the matchpairs setting multibyte aware.
                                  >

                                  Updated patch, now also works for non multi-byte builts.


                                  regards,
                                  Christian
                                  --
                                  Aus einer Menge von unordentlichen Strichen bildet man sich leicht
                                  eine Gegend, aber aus unordentlichen Tönen keine Musik.
                                  -- Georg Christoph Lichtenberg

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