zsh-users
 help / color / mirror / code / Atom feed
* Display a function
@ 2003-12-17  9:59 zzapper
  2003-12-17 10:02 ` Andy Spiegl
  0 siblings, 1 reply; 6+ messages in thread
From: zzapper @ 2003-12-17  9:59 UTC (permalink / raw)
  To: zsh-users

Hi Ya zshellers

Is it possible to "list" a function in zsh, so that I can check it's
code???


zzapper (vim & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Display a function
  2003-12-17  9:59 Display a function zzapper
@ 2003-12-17 10:02 ` Andy Spiegl
  2003-12-17 10:19   ` zzapper
  2003-12-17 10:46   ` Dominik Vogt
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Spiegl @ 2003-12-17 10:02 UTC (permalink / raw)
  To: zsh-users

> Is it possible to "list" a function in zsh, so that I can check it's
> code???
Yep: which functionname

or: functionname and then "expand-last-word"

Chau,
 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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 USER, n.:  The word computer professionals use when they mean "idiot."
               -- Dave Barry, "Claw Your Way to the Top"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Display a function
  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
  2003-12-17 10:46   ` Dominik Vogt
  1 sibling, 2 replies; 6+ messages in thread
From: zzapper @ 2003-12-17 10:19 UTC (permalink / raw)
  To: zsh-users

On Wed, 17 Dec 2003 11:02:32 +0100, Andy Spiegl <zsh.Andy@spiegl.de>
wrote:

>> Is it possible to "list" a function in zsh, so that I can check it's
>> code???
>Yep: which functionname
>
>or: functionname and then "expand-last-word"
>

> cat $(which lth)   worked just dandy

but I don't know how to use

functionname and then "expand-last-word"

(Thanx for record quick reply!!)

zzapper (vim & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Display a function
  2003-12-17 10:02 ` Andy Spiegl
  2003-12-17 10:19   ` zzapper
@ 2003-12-17 10:46   ` Dominik Vogt
  1 sibling, 0 replies; 6+ messages in thread
From: Dominik Vogt @ 2003-12-17 10:46 UTC (permalink / raw)
  To: zsh-users

On Wed, Dec 17, 2003 at 11:02:32AM +0100, Andy Spiegl wrote:
> > Is it possible to "list" a function in zsh, so that I can check it's
> > code???
> Yep: which functionname
> 
> or: functionname and then "expand-last-word"

Or use

  $ typeset -f funcname

or type

  $ functions

to display the body of all functions.

Ciao

Dominik ^_^  ^_^


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Display a function
  2003-12-17 10:19   ` zzapper
@ 2003-12-17 11:11     ` zzapper
  2003-12-17 14:23     ` Andy Spiegl
  1 sibling, 0 replies; 6+ messages in thread
From: zzapper @ 2003-12-17 11:11 UTC (permalink / raw)
  To: zsh-users

On Wed, 17 Dec 2003 10:19:30 +0000, zzapper <david@tvis.co.uk> wrote:

>On Wed, 17 Dec 2003 11:02:32 +0100, Andy Spiegl <zsh.Andy@spiegl.de>
>wrote:
>
>>> Is it possible to "list" a function in zsh, so that I can check it's
>>> code???
>>Yep: which functionname
>>
>>or: functionname and then "expand-last-word"
>>
>
>> cat $(which lth)   worked just dandy
>
Sorry got confused between functions & scripts

which  functionname works just fine.

cat $(which lth)   worked for a script

zzapper (vim & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Display a function
  2003-12-17 10:19   ` zzapper
  2003-12-17 11:11     ` zzapper
@ 2003-12-17 14:23     ` Andy Spiegl
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Spiegl @ 2003-12-17 14:23 UTC (permalink / raw)
  To: zsh-users

> 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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-12-17 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-17  9:59 Display a function 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
2003-12-17 10:46   ` Dominik Vogt

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).