Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion of CLI parameters

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.
># 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-- ))
># Insert history substitution characters
># Go back to start position, remembering extra characters.
>(( CURSOR = pos + 2 ))
># Search for end of word.
>while [[ -n $RBUFFER && $RBUFFER[1] != [[:space:]] ]]; do
>  (( CURSOR++ ))
># Insert trailing history substitution characters.
># Use magic-space to expand the history substitution.
>zle magic-space

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

I presumably need a 
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

Messages sorted by: Reverse Date, Date, Thread, Author