From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 5b1c601e for ; Thu, 20 Feb 2020 15:32:32 +0000 (UTC) Received: (qmail 1055 invoked by alias); 20 Feb 2020 15:32:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24701 Received: (qmail 21637 invoked by uid 1010); 20 Feb 2020 15:32:26 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua1-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25725. spamassassin: 3.4.2. Clear:RC:0(209.85.222.46):SA:0(-2.0/5.0):. Processed in 0.752725 secs); 20 Feb 2020 15:32:26 -0000 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.222.46 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xN2dhSyZ06mpFzl4kzVoYarRQ1P3A2FThnA3zxO5gGg=; b=Tl0gh0nAdVMSBa3fNxVmoinbud3ySmUq1Xnt8qxf9ixjU3dDs0vKubd+JXgfyaeZ+f pAUHGEL2eQupxfH20rT49IHb6KjAY4QqBFRNpiRRD5o+pyWEcr7rMClg4gVIGO6i/EaA k+dIX1dO6NTF8+sAEUzdSZSfLmR0G0c336K/dqqKCen7nv5lu7GxST3UNERNj9iKbtYI af2F9Gkxf2u7/kojTbcjXjLpVlRslIoFj3EPBeN+FEOmzXXKS2iYjJmnydAklj5ySABb jwQ9LYjkclIok0sxIeuDMmtptgJ7DYuh74jUeIgsXdOu9E+VUkM5yUw6pkBEZlCznN6N zsxg== X-Gm-Message-State: APjAAAWBeqTG0P2JUMjblLUnNm1mFx7Iu2esv/pfa+tM4gFtxV9zdK/H MwvvyEW0bfjcceTATMChhV1xXgBQlavnXpgIDaAz96uh X-Google-Smtp-Source: APXvYqwDNIpEO38szWb1IV5cWq911WK4kyJQ99xUAGT9thZGSAIjhnajb3PBMLujuS4fkO1wVHJ8RRme+Lt5QCwytMk= X-Received: by 2002:ab0:3773:: with SMTP id o19mr16710965uat.30.1582212712741; Thu, 20 Feb 2020 07:31:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Thu, 20 Feb 2020 16:31:16 +0100 Message-ID: Subject: Re: history expansion To: Mikael Magnusson Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000b3be75059f039a7c" --000000000000b3be75059f039a7c Content-Type: text/plain; charset="UTF-8" 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 ha scritto: > On 2/20/20, Pier Paolo Grassi 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 > --000000000000b3be75059f039a7c--