• [vim] Side effects of extending 'matchpairs' ?

    From Janis Papanagnou@21:1/5 to All on Fri Dec 29 17:09:27 2023
    When editing HTML files with Vim I pondered about extending the
    'matchpairs' setting for editing convenience. The default is

    matchpairs=(:),{:},[:]

    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I'd like to hear opinions about making that a fix change in the
    configuration file. Or keep it an ad hoc change on demand? Could
    there be any undesired side-effects I didn't think of when making
    it persistent?

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to janis_papanagnou+ng@hotmail.com on Sat Dec 30 07:24:37 2023
    In comp.editors, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    When editing HTML files with Vim I pondered about extending the
    'matchpairs' setting for editing convenience. The default is

    matchpairs=(:),{:},[:]

    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I'd like to hear opinions about making that a fix change in the
    configuration file. Or keep it an ad hoc change on demand? Could
    there be any undesired side-effects I didn't think of when making
    it persistent?

    You can use vim's auto commands to make that happen for only HTML files
    if you like.

    autocmd BufNewFile,BufRead *.html set matchpairs=(:),{:},[:],<:>

    Personally I stick a bunch of Unicode pairs in there, too.

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

    I keep showmatch turned off, so I don't know if the worst case is worse,
    but, daily drive over a year, no issues with manual % matching.

    Elijah
    ------
    edited some of the pairs out

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Eli the Bearded on Sat Dec 30 19:40:09 2023
    On 30.12.2023 08:24, Eli the Bearded wrote:
    In comp.editors, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    When editing HTML files with Vim I pondered about extending the
    'matchpairs' setting for editing convenience. The default is

    matchpairs=(:),{:},[:]

    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I'd like to hear opinions about making that a fix change in the
    configuration file. Or keep it an ad hoc change on demand? Could
    there be any undesired side-effects I didn't think of when making
    it persistent?

    You can use vim's auto commands to make that happen for only HTML files
    if you like.

    Yes, I thought about making it file-type specific.


    autocmd BufNewFile,BufRead *.html set matchpairs=(:),{:},[:],<:>

    Personally I stick a bunch of Unicode pairs in there, too.

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

    Interesting. And funny that the page exactly asks what I was looking
    for. (BTW, thanks for the Unicode text file you linked on the page.
    Very useful.)


    I keep showmatch turned off, so I don't know if the worst case is worse,
    but, daily drive over a year, no issues with manual % matching.

    Good to know. Exactly the experience feedback I hoped for. Thanks.

    I think I'll even try to make it persistent and see how it evolves.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rene Kita@21:1/5 to Janis Papanagnou on Sat Dec 30 19:46:08 2023
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    When editing HTML files with Vim I pondered about extending the
    'matchpairs' setting for editing convenience. The default is

    matchpairs=(:),{:},[:]

    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I'd like to hear opinions about making that a fix change in the
    configuration file. Or keep it an ad hoc change on demand? Could
    there be any undesired side-effects I didn't think of when making
    it persistent?

    I use this for C++ files, no undesired side-effects so far. It works.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Rene Kita on Mon Jan 1 23:45:08 2024
    On 30.12.2023 20:46, Rene Kita wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    When editing HTML files with Vim I pondered about extending the
    'matchpairs' setting for editing convenience. The default is

    matchpairs=(:),{:},[:]

    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I'd like to hear opinions about making that a fix change in the
    configuration file. Or keep it an ad hoc change on demand? Could
    there be any undesired side-effects I didn't think of when making
    it persistent?

    I use this for C++ files, no undesired side-effects so far. It works.

    This is great! - I didn't think of C++ (despite using it occasionally).

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jens Schweikhardt@21:1/5 to All on Mon Jan 1 23:00:40 2024
    Eli the Bearded <*@eli.users.panix.com> wrote
    in <eli$2312300200@qaz.wtf>:
    [...]
    # https://qaz.wtf/qz/blosxom/2022/06/02/matchpairs

    There's a buglet,
    set matchpairs=(:),[:],{:},<,>
    should be
    set matchpairs=(:),[:],{:},<:>

    Regards,

    Jens
    --
    Jens Schweikhardt http://www.schweikhardt.net/
    SIGSIG -- signature too long (core dumped)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Janis Papanagnou on Tue Jan 2 06:13:14 2024
    On 01.01.2024 23:45, Janis Papanagnou wrote:
    On 30.12.2023 20:46, Rene Kita wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    For the HTML editing purpose I temporarily change that to

    matchpairs=(:),{:},[:],<:>

    I use this for C++ files, no undesired side-effects so far. It works.

    This is great! - I didn't think of C++ (despite using it occasionally).

    BTW, for C++ it works also nicely on _nested_ template expressions
    (like with the other three bracket types). And also Vim's brackets
    operator expressions, like y3a( or d2i{ , extend the (, {, [
    operations nicely on < as in c2a< .

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)