Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: history expansion



something like an alias that could allow me to reuse history expandable
expressions, such as !!, !:1, ^cdcd^cddcd and so on

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 14:27 Vin Shelton <
acs@xxxxxxxxxxxxxxxxxxxx> ha scritto:

> I still do not understand: what do you want to do?  Do you want to create
> an alias that modifies the history expansion in some particular way?
>
>   - Vin
>
> On Thu, Feb 20, 2020 at 8:19 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
> wrote:
>
>> Hi Vin, it does not because:
>>
>> 20-02-20 14:16:45 root@bakeca-vivobook Path: ~
>> : print -z '!!'
>> 20-02-20 14:16:47 root@bakeca-vivobook Path: ~
>> : !!
>> print -z '!!'
>>
>> !! is resolved to print -z '!!'
>> If I had used it like you did, as !! unquoted, it would not be aliasable,
>> so I would incur in my original problem
>> thanks
>>
>> 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 14:06 Vin Shelton <
>> acs@xxxxxxxxxxxxxxxxxxxx> ha scritto:
>>
>>> I'm not sure I understand what you mean.  Does
>>>
>>> print -z !!
>>>
>>> do what you want?  Perhaps you want to try out other batch substitutions
>>> (e.g. "!:1") before you use "print -z", which enables interactive editing.
>>>
>>> HTH,
>>>   Vin
>>>
>>> On Thu, Feb 20, 2020 at 7:46 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
>>> wrote:
>>>
>>>> hello, history expansion is quite the powerful syntax for re-executing
>>>> commands from history with various functionalities for automatic
>>>> transformation. Since it happens before alias expansion it is not
>>>> possibile
>>>> to simplify the access to these functionalities though, and one have to
>>>> remember and type every time the right syntax, and in case of error you
>>>> have to type everything again.
>>>> Is that it or am I missing some way to reuse it?
>>>> I have just thought of a custom widget that could add to $BUFFER a
>>>> history
>>>> command of one's choice, are there other ways?
>>>>
>>>> Pier Paolo Grassi
>>>> linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
>>>> founder: https://www.meetup.com/it-IT/Machine-Learning-TO
>>>>
>>>


Messages sorted by: Reverse Date, Date, Thread, Author