zsh-workers
 help / color / mirror / code / Atom feed
* Re: Completion of CLI parameters
       [not found] ` <10100.1083173945@csr.com>
@ 2004-04-29  8:35   ` zzapper
       [not found]     ` <3763.1083238815@csr.com>
  0 siblings, 1 reply; 2+ messages in thread
From: zzapper @ 2004-04-29  8:35 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

On Wed, 28 Apr 2004 18:39:05 +0100,  wrote:

>zzapper wrote:
>> Hi,
>> 
>> > cmd1 p1 p2 p3
>> > cmd2
>> ....
>> ...
>> 
>> > cmdx p4 p5
>> > cmdy <I would like to complete to get p1 p2 p3 without knowing history numb
>> er?>
>
>cmdy !?cmd1?:*<TAB>
>
That's cool, bit of a type-fest though!!

zzapper (vim, cygwin, wiki & 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] 2+ messages in thread

* Re: Completion of CLI parameters
       [not found]     ` <3763.1083238815@csr.com>
@ 2004-04-29 12:46       ` zzapper
  0 siblings, 0 replies; 2+ messages in thread
From: zzapper @ 2004-04-29 12:46 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

On Thu, 29 Apr 2004 12:40:15 +0100,  wrote:

>
>Here's a zle widget called insert-args-of which does the whole thing.
>Type `cmd1' and execute the widget.  Actually, !? searches for a string
>inside the command, so it's more powerful than I suggested.  What you
>asked for works without the `?'s.
>
>Works without `banghist' in use, since turning that on locally seems to
>be sufficient.
>
>
>#start
># Zle widget to look at a string and replace it with the arguments
># of the last command in the history containing that string.
>
>emulate -L zsh
>setopt banghist
>
># Remember position
>integer pos=$CURSOR
>
># Find start of word.  Just use whitespace.
>while [[ $CURSOR -gt 1 && $LBUFFER[-1] != [[:space:]] ]]; do
>  (( CURSOR-- ))
>done
>
># Insert history substitution characters
>LBUFFER+="!?"
>
># Go back to start position, remembering extra characters.
>(( CURSOR = pos + 2 ))
>
># Search for end of word.
>while [[ -n $RBUFFER && $RBUFFER[1] != [[:space:]] ]]; do
>  (( CURSOR++ ))
>done
>
># Insert trailing history substitution characters.
>LBUFFER+="?:*"
>
># Use magic-space to expand the history substitution.
>zle magic-space
>#end

Sorry to abuse your helpfullness but could you give me a complete
"idiots guide".

I presumably need a 
zle
bindkey
function insert-args-of 

Do these all go in my startup files? (I use .zshenv)


zzapper (vim, cygwin, wiki & 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] 2+ messages in thread

end of thread, other threads:[~2004-04-29 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <hqkv80hr6tgp15jite7uub0d6gbmge48oq@4ax.com>
     [not found] ` <10100.1083173945@csr.com>
2004-04-29  8:35   ` Completion of CLI parameters zzapper
     [not found]     ` <3763.1083238815@csr.com>
2004-04-29 12:46       ` zzapper

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