From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk (Zsh users list)
Subject: Re: Expanding interactively aliases
Date: Tue, 20 Feb 2001 15:45:44 +0000 [thread overview]
Message-ID: <Tc0a8890c51d8f3b42a@mailsweeper01.cambridgesiliconradio.com> (raw)
In-Reply-To: Your message of "Tue, 20 Feb 2001 14:47:37 +0100." <200102201347.f1KDlbT13110@linux3.maruska.tin.it>
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 <pws@csr.com> Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
prev parent reply other threads:[~2001-02-20 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-20 13:47 Michal Maru¹ka
2001-02-20 15:45 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Tc0a8890c51d8f3b42a@mailsweeper01.cambridgesiliconradio.com \
--to=pws@csr.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).