Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Display a function
- X-seq: zsh-users 6914
- From: Andy Spiegl <zsh.Andy@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Display a function
- Date: Wed, 17 Dec 2003 15:23:00 +0100
- In-reply-to: <l9b0uvoi6eaierf2nqvnf8ge7j91a91642@xxxxxxx>
- Kreccount: 1
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: KasCada GbR
- References: <f4a0uvcslnjo73kc469refd63oseg38tri@xxxxxxx> <20031217100232.GA2091@xxxxxxxxx> <l9b0uvoi6eaierf2nqvnf8ge7j91a91642@xxxxxxx>
> but I don't know how to use
>
> functionname and then "expand-last-word"
expand-last-word() {
setopt localoptions extendedglob
local skip="${(M)LBUFFER%%[ \;\|\{\}]##}"
local word="${(M)${LBUFFER%${skip}}%%[^ \;\|\{\}]##}" exp
if (( $+aliases[$word] )); then
exp="$aliases[$word]"
elif (( $+functions[$word] )); then
exp="$functions[$word]"
elif (( $+commands[$word] )); then
exp="$commands[$word]"
fi
[[ -n "$exp" ]] && LBUFFER="${LBUFFER%${word}${skip}}${exp}${skip}"
}
zle -N expand-last-word
bindkey "ESCn" expand-last-word
And then just press ALT-n after typing the functionname.
Andy.
--
http://peru.spiegl.de Our project
http://radiomaranon.org.pe Radio Marañón, Jaén, Perú
o _ _ _
------- __o __o /\_ _ \\o (_)\__/o (_) -o)
----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\
---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Give a man a fish, and he will eat for a day.
Teach a man to fish and he will eat for a lifetime.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author