Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Expanding global aliases on key press
- X-seq: zsh-users 13876
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Expanding global aliases on key press
- Date: Wed, 25 Feb 2009 02:53:38 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=yN5IXa5/fIkBuXddof4it8f4D1pJuhYFRiZhiIZzBXE=; b=ZY+XPTEADh3KCkbrYd306D1iWrz/8ItcohzOid1J2jGRjcG9RRssd9AG0Y+DaoxpTf NOylOo5VnQiJ9xc8LZMLi2M9GXazCgMMyPlu/68csDxF1R7NZhAhvZq6FxKfoRn4TJ0X 08kTEV3Fx3kxzeMl7qKhN88qaSz9Xsn54ybto=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=rvxNASFpFq8T3TcwLs2aLFhfgWFGqC5tOl3TSakUCD5oqHrEFSWxqWYxKr1vrjWGyF +QPI4yN0USDuQ7NVZmR0fV7jtX1WtQsts+qJMy5kQJP3Df+U/M4ug5fMz7k3B2+sT4Ii FaToz7pj5OgPrfPBssyCig/iBrrFtUQf36lKE=
- In-reply-to: <go20an$4p6$1@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <go20an$4p6$1@xxxxxxxxxxxxx>
2009/2/25 Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>:
> Hi,
>
> I've read the new German Zsh book that was mentioned here some time ago
> (by the way: a huuuuge disappointment) and I've found this particular
> widget to expand global aliases on pressing blank:
>
> #
> global-alias-space()
> { local ga="$LBUFFER[(w)-1]"
> [[ -n $ga ]] && LBUFFER[(w)-1]="${${galiases[$ga]}:-$ga}"
> zle self-insert;}
>
> zle -N global-alias-space
> bindkey ' ' global-alias-space
> #
>
> Can anyone comment on the code, please?
>
> Additionally I've adapted this widget to be bound to the Enter key:
>
> #
> accept-line()
> { local ga="$LBUFFER[(w)-1]"
> [[ -n $ga ]] && LBUFFER[(w)-1]="${${galiases[$ga]}:-$ga}"
> zle .accept-line;}
>
> zle -N accept-line
> #
>
> I'd also like to hear your comments on that...
This seems much simpler:
global-alias-space () { zle _expand_alias; zle .self-insert }
zle -N global-alias-space
bindkey ' ' global-alias-space
zstyle :completion:\* regular false # I can't figure out how to
specify this more exactly
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author