zsh-users
 help / color / mirror / code / Atom feed
* completion argument-n enabling
@ 2006-03-02 12:37 Phil Pennock
  2006-03-02 16:05 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Pennock @ 2006-03-02 12:37 UTC (permalink / raw)
  To: zsh-users

Continuing my education in my own stupidity, I continue to have problems
trying to migrate to the zshcompsys completion.  I write small shell
convenience functions and used to write compctl settings for them. In
this instance, I've gotten most of the way there.

I'm sure that the answers are really simple and education is
appreciated.  Thanks.

Given:
 function cyrus { sudo -H -u cyrus "/usr/lib/cyrus/$1" "${argv[2,-1]}" }
I've managed to produce a mostly-working set-up:
 zstyle ':completion:*:*:cyrus:*' file-patterns '/usr/lib/cyrus/*(*\:t)'

However, I only want that completion to occur for the first parameter;
but argument-n context needs to be enabled and I can't figure out how to
do that.  To make:
 zstyle ':completion:*:*:cyrus:argument-1:*' file-patterns \
						 '/usr/lib/cyrus/*(*\:t)'
work, what do I actually need to do please?  The nearest that I could
figure out was: zstyle ':completion:*:*:cyrus:*:arguments' _normal
but that doesn't work.

Also, if I instead use:
 compdef '_files -g "/usr/lib/cyrus/*(*:t)"' -P '' cyrus
(I know, it deals with all parameters, not just the first) why am I
prompted with two sets of results, the correct filenames and then the
sub-directories of the cwd?

Are there any simple examples which I should be looking for, covering
this sort of thing?  The stuff I can find all uses custom _cmdname
widgets and I couldn't find anything just offering plain "how to do X"
for the sort of thing I'm attempting.  The nearest seems to be
StartupFiles/zshrc which falls just shy of providing an example of
per-command completion.

Thanks,
-- 
I am keeping international relations on a peaceable footing.
You are biding your time before acting.
He is coddling tyrants.
 -- Roger BW on topic of verb conjugation


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

end of thread, other threads:[~2006-03-02 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02 12:37 completion argument-n enabling Phil Pennock
2006-03-02 16:05 ` Peter Stephenson

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