From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: Completion of CLI parameters
Date: Thu, 29 Apr 2004 14:59:58 +0000 [thread overview]
Message-ID: <1040429145959.ZM31110@candle.brasslantern.com> (raw)
In-Reply-To: <15385.1083243379@csr.com>
On Apr 29, 1:56pm, Peter Stephenson wrote:
}
} autoload -U insert-args-of
} zle -N insert-args-of
} bindkey '^x^a' insert-args-of
Oliver would say this was crying out to be a _generic completer; here's
a trivial stab at one. However, the right thing would be for _expand to
recognize a zstyle -- perhaps named "expander" -- that would supply a
function to produce expansions, and to try calling that before falling
back on the usual shell expansions. That way we'd get the full power of
all the other styles recognized by _expand.
The following suffers from the usual problems of menus that may contain
multi-line structures, I haven't done anything to address that.
#autoload
# Name this file expand-args-of and place it in a $fpath directory, and
# then add these commands to .zshrc:
# zle -C expand-args-of complete-word _generic
# zstyle ':completion:expand-args-of::::' completer expand-args-of
# bindkey '^x^a' expand-args-of
local pat=$words[CURRENT]
local -a exp
if ((CURRENT > 1))
then
# Remove the first * here to match on command name only
exp=( $history[(R)*${(q)pat}*] )
exp=( ${exp#*[[:space:]]} )
else
exp=( $history[(R)${(q)pat}*] )
fi
compadd -UQ -a exp
compstate[insert]=menu
#end of expand-args-of
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2004-04-30 5:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a5u190lnjueh9jiu4ci6bq5uimo4d5tu37@4ax.com>
2004-04-29 12:56 ` Peter Stephenson
2004-04-29 14:59 ` Bart Schaefer [this message]
2004-05-01 14:14 ` zzapper
2004-05-01 17:50 ` Bart Schaefer
2004-05-02 15:35 ` zzapper
[not found] <4me190pohevfcnoecm43f7ab9cclh3233g@4ax.com>
2004-04-29 11:40 ` Peter Stephenson
2004-04-28 15:56 zzapper
2004-04-28 17:39 ` Peter Stephenson
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=1040429145959.ZM31110@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--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).