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 9dbb38dc for ; Thu, 20 Feb 2020 15:26:15 +0000 (UTC) Received: (qmail 22818 invoked by alias); 20 Feb 2020 15:26:04 -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: 24700 Received: (qmail 13212 invoked by uid 1010); 20 Feb 2020 15:26:04 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f50.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.166.50):SA:0(-2.0/5.0):. Processed in 0.7029 secs); 20 Feb 2020 15:26:04 -0000 X-Envelope-From: mikachu@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.166.50 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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YZZDHhH7wPWj1ZFoTHDuPhbdEZrm8CVm8e5Tr1xKERI=; b=Wj0uXi6uW6EWrJl1lELDp5RVcPFbhZfgwFeqz9yWCWbRjac17VpU/9U9215SZx4XSg xrcUu0mlUSBFjo13IOqLw3zDvWUdH0QVKhmcw2XizDLTIMffB97gpr6FghpFMzwT/BYt hGT41WsXNnqCR3/Ga+sd4iWnOwBfKBQ3D+7zIQ179IQ/eI7OuGYdifWxh4RVxX4NbMpm VCYLQN/5hypp/4plGTozQM0aja/8vvK3ZWnPWskMrJ7Ted8ttUlOULItX2Bwojh3Vr/8 ZB28yq+ZE8TJFDkm7OyEdPxRXjstJXjTZmVQqK6iNylYJn0bHhYY33AOU0Hg5BXvTUJ6 WxFw== X-Gm-Message-State: APjAAAU3Zehd9vquBJEf5skly8NSVWvtF6sUCDJyBBJGRXyZMHZayexJ GEDLq3j0hkY/LA2P1BXiWKV5NwISMFil0mVYExc= X-Google-Smtp-Source: APXvYqwR/gyeq+n9KOTKDqdVBNKiR7VGz7yMtHjn9uEXVZi/U2VRqiJz5llR9fjzOpp5cbfx/4yQFUSAiQR+by20CJ8= X-Received: by 2002:a02:aa11:: with SMTP id r17mr25659971jam.88.1582212329372; Thu, 20 Feb 2020 07:25:29 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Mikael Magnusson Date: Thu, 20 Feb 2020 16:25:27 +0100 Message-ID: Subject: Re: history expansion To: Pier Paolo Grassi Cc: Zsh-Users List Content-Type: text/plain; charset="UTF-8" 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