From: zzapper <david@tvis.co.uk>
To: zsh-workers@sunsite.dk
Cc: zsh-users@sunsite.dk
Subject: Re: Completion of CLI parameters
Date: Thu, 29 Apr 2004 13:46:55 +0100 [thread overview]
Message-ID: <a5u190lnjueh9jiu4ci6bq5uimo4d5tu37@4ax.com> (raw)
In-Reply-To: <3763.1083238815@csr.com>
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
prev parent reply other threads:[~2004-04-29 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <hqkv80hr6tgp15jite7uub0d6gbmge48oq@4ax.com>
[not found] ` <10100.1083173945@csr.com>
2004-04-29 8:35 ` zzapper
[not found] ` <3763.1083238815@csr.com>
2004-04-29 12:46 ` zzapper [this message]
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=a5u190lnjueh9jiu4ci6bq5uimo4d5tu37@4ax.com \
--to=david@tvis.co.uk \
--cc=zsh-users@sunsite.dk \
--cc=zsh-workers@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).