Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Expanding global aliases on key press
- X-seq: zsh-users 13874
 
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
 
- To: zsh-users@xxxxxxxxxx
 
- Subject: Expanding global aliases on key press
 
- Date: Wed, 25 Feb 2009 00:36:36 +0100
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
- Sender: news <news@xxxxxxxxxxxxx>
 
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...
Thorsten
Messages sorted by:
Reverse Date,
Date,
Thread,
Author