Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history expansion
- X-seq: zsh-users 24701
- From: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: history expansion
- Date: Thu, 20 Feb 2020 16:31:16 +0100
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- In-reply-to: <CAHYJk3QujSp07HMqH2K=HPa7ECzDvRy7_V3T0aDRwnCYHixYUQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAP+y1xA-Pm1-kiuvODNHRteGAEbOOA7PDqR6mYF+v-hvBYiCZA@mail.gmail.com> <CACeGjnUZ_UJAqm=xZbN5Gof+G8M-Y9zATf433FSApV=avp5G1g@mail.gmail.com> <CAP+y1xB3=zPcUhd_qJ3nDBPvx8XOoHPqDn0Btby-r=bBpoOVEg@mail.gmail.com> <CACeGjnX=weLLEp6q4nOur-2U6YfU4E8sxBvmvwyDuZcJ30FDEA@mail.gmail.com> <CAP+y1xAq-MOLtcdHd_q6j8azmWX7FLOg=p9Ff4MxDGU2Q2Ov5A@mail.gmail.com> <CAHYJk3QujSp07HMqH2K=HPa7ECzDvRy7_V3T0aDRwnCYHixYUQ@mail.gmail.com>
that's a nice idea, thanks Mikael
Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO
Il giorno gio 20 feb 2020 alle ore 16:25 Mikael Magnusson <mikachu@xxxxxxxxx>
ha scritto:
> On 2/20/20, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> > something like an alias that could allow me to reuse history expandable
> > expressions, such as !!, !:1, ^cdcd^cddcd and so on
>
> If you make an alias like normal, but instead of pressing enter, press
> ^Xa (_expand_alias), it should do what you want. This could then be
> extended with a custom widget bound to accept-line that checks if the
> current input is one of your special history-aliases and expand it for
> you before accepting the line, etc.
> skeleton example of the latter,
> zle -N accept-line accept-line-history-alias
> accept-line-history-alias() {
> if [[ $BUFFER = histalias-* ]]; then
> zle _expand_alias
> fi
> zle .$WIDGET
> }
> if you go this route, you could also use a custom lookup assoc array
> instead of using aliases.
>
> --
> Mikael Magnusson
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author