Re: Match <div and </div>
Benno Schulenberg <[email protected]> Wed, 25 Jan 2023 12:53:55 +0100
| Newsgroups | gmane.editors.nano.general |
|---|---|
| Message-ID | <[email protected]> |
Op 25-01-2023 om 07:38 schreef Seb:
> This code didn't work for me, [...]
Ah, yes. I forgot that the control codes need to be "escaped": they
need to be entered verbatim at the prompt. But for some reason the
{verbatim} function does not work. :/
What does work is a literal M-V (^[v, where ^[ is a literal escape).
So this works (tested):
bind M-B "{replace}<div{enter}^[v^Q{enter}A
{replace}</div{enter}^[v^R{enter}A
{replace}<form{enter}^[v^S{enter}A
{replace}</form{enter}^[v^T{enter}A
{findbracket}
{replace}^[v^T{enter}</form{enter}A
{replace}^[v^S{enter}<form{enter}A
{replace}^[v^R{enter}</div{enter}A
{replace}^[v^Q{enter}<div{enter}A
{left}{right}" main
(When using 'set matchbrackets "(<[{«^Q^S)>]}»^R^T"', of course.)
Of course, the above is majorly ugly -- it's better to use some
normal, printable characters that you don't use in the documents.
The failure of {verbatim} has been reported here:
https://savannah.gnu.org/bugs/?63702
Benno
OpenPGP_signature
(application/pgp-signature, 840 B) - not displayed