From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Filename expansion within a completion widget
Date: Wed, 3 Nov 2004 18:19:47 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.61.0411031754500.470@toltec.zanshin.com> (raw)
In-Reply-To: <20041102234409.GB21654@DervishD>
On Wed, 3 Nov 2004, DervishD wrote:
> > compset -P '*/'
> >
> > Well, it handles both relative and absolute directories
> > correctly, but doesn't handle named directories :(( I don't
> > understand why because if I type 'cd ~X<TAB>' the named dir should be
> > expanded, shouldn't it?
"Expanded" would mean that ~X was replaced by the path it represents.
Yet later you say this isn't the behavior you want. If the variable is
really $X11, for example, then converting ~X to ~X11 is not "expanding",
it's "completing", at least in zsh's terminology (e.g., for purposes of
the widget "expand-or-complete").
And if you've written your own completion widget, you have to do the
completing yourself, right?
> Of course, adding something like 'PREFIX=$~PREFIX' just before
> the compset call solves the problem, but then the named dir is
> 'translated', which I don't want
Just because you're not using zsh's completion system functions doesn't
mean you can't look at them for hints. Completion/Unix/Type/_tilde_files
would be a good place to start; note in particular the case statement on
$PREFIX.
> There is surely another way of doing this...
The short answer is that if there is not a slash in the string yet, you
remove the tilde from consideration with compset -P, and then you compadd
the userdirs and/or nameddirs arrays from the zsh/parameter module. If
there is a slash in the string, you have to manipulate IPREFIX and then
use compadd -W.
next prev parent reply other threads:[~2004-11-04 2:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 23:36 DervishD
2004-11-02 23:44 ` DervishD
2004-11-04 2:19 ` Bart Schaefer [this message]
2004-11-04 10:33 ` DervishD
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=Pine.LNX.4.61.0411031754500.470@toltec.zanshin.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).