From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16053 invoked from network); 20 Feb 2001 15:46:28 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Feb 2001 15:46:28 -0000 Received: (qmail 3708 invoked by alias); 20 Feb 2001 15:46:15 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3636 Received: (qmail 3697 invoked from network); 20 Feb 2001 15:46:15 -0000 Message-ID: To: zsh-users@sunsite.dk (Zsh users list) Subject: Re: Expanding interactively aliases In-Reply-To: Your message of "Tue, 20 Feb 2001 14:47:37 +0100." <200102201347.f1KDlbT13110@linux3.maruska.tin.it> Date: Tue, 20 Feb 2001 15:45:44 +0000 From: Peter Stephenson Michal Maru ka wrote: > Is it possible (as in Bash 2.03) to expand an alias > and edit it after ? You could use this function (e.g. `edit-alias myalias'), if what you want is to change the definition of the alias. edit-alias() { local al al="$(alias $1)" || return 1 print -z alias $al } Otherwise, if you just want the alias inlined in the code, and have a recent zsh 3.1, try expand-alias() { # for safety, in case there's an = which will mess things up... local alias=${LBUFFER#*=} if ! alias=$(alias $LBUFFER); then zle beep return 1 fi LBUFFER=${(Q)${alias#*=}} } zle -N expand-alias bindkey '^xa' expand-alias and hit ^xa just after the alias (I'm assuming it's at the beginning of the line, else there's more work to be done). Quite possibly Sven has already added an option to the _expand completer by now, otherwise I'll try and remember to look at that. -- Peter Stephenson Software Engineer Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070