% and matchpairs

25 views
Skip to first unread message

Eli the Bearded

unread,
Jun 5, 2022, 8:47:13 PM6/5/22
to vim...@googlegroups.com
One neat thing about vim is configurability. I think it's widely known
(and done) to add < and > to matchpairs for %, but you can add Unicode
pairs in the list to, for smart quotes and quote styles not used in
English (at ast not often).

I decided to try the extreme and described my method here:

https://qaz.wtf/qz/blosxom/2022/06/02/matchpairs

But some of those, I'm never expecting to actually encounter (left and
right speech bubbles, as enclosing characters? not likely).

Here's what I've edited the list down to for my own use:

:set matchpairs=<:>,(:),[:],{:},«:»,𝄆:𝄇,👉:👈,🕻:🕽,🖙:🖘,🖛:🖚,🖝:🖜,🗦:🗧,🙬:🙮,🤜:🤛,‘:’,“:”,‹:›,⁅:⁆,⁌:⁍,⁽:⁾,₍:₎,⊣:⊢,⋉:⋊,⌈:⌉,⌊:⌋,〈:〉,⎛:⎞,⎜:⎟,⎝:⎠,⎡:⎤,⎢:⎥,⎣:⎦,⎧:⎫,⎨:⎬,⎩:⎭,⏪:⏩,⏮:⏭,⏴:⏵,◀:▶,◁:▷,◂:▸,◃:▹,◄:►,◅:▻,☛:☚,☞:☜,⚟:⚞,❨:❩,❪:❫,❬:❭,❮:❯,❰:❱,❲:❳,❴:❵,⟅:⟆,⟕:⟖,⟞:⟝,⟢:⟣,⟤:⟥,⟦:⟧,⟨:⟩,⟪:⟫,⟬:⟭,⟮:⟯,⥼:⥽,⦃:⦄,⦅:⦆,⦇:⦈,⦉:⦊,⦋:⦌,⦍:⦐,⦏:⦎,⦑:⦒,⦗:⦘,⧘:⧙,⧚:⧛,⧼:⧽,⫍:⫎,⯇:⯈,⸂:⸃,⸄:⸅,⸉:⸊,⸌:⸍,⸜:⸝,⸠:⸡,⸦:⸧,⸨:⸩,⸶:⸷,⹑:⹐,⹕:⹖,⹗:⹘,〈:〉,《:》,「:」,『:』,【:】,〔:〕,〖:〗,〘:〙,〚:〛,꧁:꧂,﴾:﴿,︵:︶,︷:︸,︹:︺,︻:︼,︽:︾,︿:﹀,﹁:﹂,﹃:﹄,﹇:﹈,﹙:﹚,﹛:﹜,﹝:﹞,(:),[:],{:},⦅:⦆,「:」

This includes multiline bracket symbols; wide ("fullwidth") versions of
characters used in CJK contexts; vertical punctuation, also for CJK
compatibility; and some hands (for which I've switched left and right
versions).

It's also a line too long for unencoded use in SMTP or NNTP, so good
thing MIME exits.

Elijah

Stan Brown

unread,
Jun 5, 2022, 9:36:03 PM6/5/22
to vim...@googlegroups.com

On 2022-06-05 17:47, Eli the Bearded wrote:
> One neat thing about vim is configurability. I think it's widely known
> (and done) to add < and > to matchpairs for %, but you can add Unicode
> pairs in the list to, for smart quotes and quote styles not used in
> English (at ast not often).

Thanks for posting about this, Eli. I did not know about matchpairs,
but adding < > and the Windows "curly quotes" will be a help to me in
editing files that will eventually be ebooks.

--
Stan Brown
Tehachapi, CA, USA
https://BrownMath.com

Grant Taylor

unread,
Jun 6, 2022, 4:53:52 PM6/6/22
to vim...@googlegroups.com
On 6/5/22 6:47 PM, Eli the Bearded wrote:
> One neat thing about vim is configurability. I think it's widely known
> (and done) to add < and > to matchpairs for %, but you can add Unicode
> pairs in the list to, for smart quotes and quote styles not used in
> English (at ast not often).

#TIL

Thank you for sharing this Eli. I'll be trying ~> using a subset of this.

Aside: How wrong is it that I'm thinking about adding m4's "`" and "'"
based on file / buffer type? a la. set matchpairs=`:'



--
Grant. . . .
unix || die

Eli the Bearded

unread,
Jun 8, 2022, 12:50:50 PM6/8/22
to vim...@googlegroups.com
On Mon, 6 Jun 2022, "'Grant Taylor' via vim_use" <vim...@googlegroups.com> wrote:
> #TIL
>
> Thank you for sharing this Eli. I'll be trying ~> using a subset of this.
>
> Aside: How wrong is it that I'm thinking about adding m4's "`" and "'"
> based on file / buffer type? a la. set matchpairs=`:'

Not wrong at all. That's a good idea.

Vaguely related: I wrote my own markup language for my blog posts. It's
a hydrid of Markdown style in-line formatting and *roff style block
formatting. _Italics_ like that, and ".p" / "./p" for open and close
paragraphs, or ".pp" to close a paragraph and start a new one. I use
"set paragraphs=ppp\ hrbri\ d\ /p" to make { and } motions work for that
filetype. "set paragraphs" is highly tuned to *roff style formatting
(namely implied initial period and max of two characters in a label)
which highly reduces the usefulness, but old Unix hands are more likely
to find/use such formatting. But I wrote the markup knowing how "set
paragraphs" works.

(The other entries in there are used for things like horizontal rules,
image tags, and image boxes.)

Elijah
Reply all
Reply to author
Forward
0 new messages