From: Andy Spiegl <zsh.Andy@spiegl.de>
To: zsh-users@sunsite.dk
Subject: Re: Display a function
Date: Wed, 17 Dec 2003 15:23:00 +0100 [thread overview]
Message-ID: <20031217142300.GA10056@spiegl.de> (raw)
In-Reply-To: <l9b0uvoi6eaierf2nqvnf8ge7j91a91642@4ax.com>
> 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.
next prev parent reply other threads:[~2003-12-17 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-17 9:59 zzapper
2003-12-17 10:02 ` Andy Spiegl
2003-12-17 10:19 ` zzapper
2003-12-17 11:11 ` zzapper
2003-12-17 14:23 ` Andy Spiegl [this message]
2003-12-17 10:46 ` Dominik Vogt
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=20031217142300.GA10056@spiegl.de \
--to=zsh.andy@spiegl.de \
--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).