That's great!
Thank you for the idea.
Peter
сре, 23. сеп 2020. у 13:21 Peter Stephenson
је написао/ла:
> > On 23 September 2020 at 09:34 Peter Slížik
> 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
>
>