Zsh Mailing List Archive
Messages sorted by:
Re: Completing within colon separated paths
- X-seq: zsh-users 3671
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx (Zsh users list), John Cooper <john.cooper@xxxxxxxxxxxxx>
- Subject: Re: Completing within colon separated paths
- Date: Wed, 14 Mar 2001 16:56:22 +0000
- In-reply-to: Your message of "14 Mar 2001 16:30:07 GMT." <m3bsr4ia9c.fsf@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Peter Stephenson <pws@xxxxxxx> writes:
> OK, thanks for the explanation, and it works for me too when doing an
> assignment. But I do also sometimes want it to perform completion correctly
> when completing a colon separated path on a cmd line (e.g., the -classpath
> argument to java or jview). Any way to force the same behavior in this
The completion function that does this is called _value in the Base
subdirectory, but it's written on the assumption that you have a real
parameter whose value you are altering. The bit you're interested in is
the stuff with
compset -P '*:' # strip stuff up to last :
compset -S ':*' # strip stuff after next colon
_default -r '\-\n\t /:' "$@" # do default completion on this
# -r is passed to compadd, see zshcompwid
You probably want to decant that into another function and use _arguments
to call this where you need it.
In fact, in this particular case I rather think you need the tweak to _java
in the patch at the bottom.
> I've just noticed that using `setopt completeinword' seems to allow me to
> complete using TAB rather than expand-or-complete-prefix.
Yes, I'd forgotten I didn't have that set.
RCS file: /cvsroot/zsh/zsh/Completion/User/_java,v
retrieving revision 1.3
diff -u -r1.3 _java
--- Completion/User/_java 2001/01/15 09:11:33 1.3
+++ Completion/User/_java 2001/03/14 16:55:16
@@ -368,6 +368,7 @@
compset -P '*:'
+ compset -S ':*'
"classpath:$state:_path_files -qS: -g '*.(jar|zip)'" \
"classpath:$state:_path_files -r': ' -/"
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
Messages sorted by: