From: "Peter Slížik" <peter.slizik@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-users@zsh.org
Subject: Re: How to avoid infinite recursion in ZLE widgets
Date: Wed, 23 Sep 2020 13:24:38 +0200 [thread overview]
Message-ID: <CAC-uhUBWek+etwGAsWs9V4fRoWDwHqSjRgqyFoFCnx=1=5yvqw@mail.gmail.com> (raw)
In-Reply-To: <2017958989.2143187.1600860090233@mail2.virginmedia.com>
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
That's great!
Thank you for the idea.
Peter
сре, 23. сеп 2020. у 13:21 Peter Stephenson <p.w.stephenson@ntlworld.com>
је написао/ла:
> > On 23 September 2020 at 09:34 Peter Slížik <peter.slizik@gmail.com>
> wrote:
> > I'd like to replicate the functionality found in some text editors -
> namely
> > that if you press a single or double quote, the editor inserts two of
> them
> > and places the cursor inside the pair.
> >
> > With some necessary checks for word boundaries, etc. left out, the
> solution
> > looks rather trivial:
> >
> > function insert-single-quotes() {
> > zle self-insert "''" # that's "_'_'_"
> > zle backward-char
> > }
>
> The right way to insert something into the buffer at this point is using
> the special variables. You can add a quote before and a quote after
> the cursor using:
>
> insert-single-quotes() {
> LBUFFER+="'"
> RBUFFER="'$RBUFFER"
> }
>
> pws
>
>
[-- Attachment #2: Type: text/html, Size: 1539 bytes --]
next prev parent reply other threads:[~2020-09-23 11:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 8:34 Peter Slížik
2020-09-23 11:21 ` Peter Stephenson
2020-09-23 11:24 ` Peter Slížik [this message]
2020-09-23 11:29 ` Daniel Shahaf
2020-09-23 11:32 ` Peter Slížik
2020-09-23 18:25 ` zsugabubus
2020-09-24 9:55 ` Peter Slížik
2020-09-25 14:19 ` Peter Slížik
2020-09-25 14:43 ` Peter Stephenson
2020-09-26 9:27 ` Daniel Shahaf
2020-09-26 9:40 ` Roman Perepelitsa
2020-09-26 10:24 ` Daniel Shahaf
2020-09-26 10:31 ` Roman Perepelitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAC-uhUBWek+etwGAsWs9V4fRoWDwHqSjRgqyFoFCnx=1=5yvqw@mail.gmail.com' \
--to=peter.slizik@gmail.com \
--cc=p.w.stephenson@ntlworld.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).