From: DervishD <zsh@dervishd.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Filename expansion within a completion widget
Date: Thu, 4 Nov 2004 11:33:58 +0100 [thread overview]
Message-ID: <20041104103358.GC23673@DervishD> (raw)
In-Reply-To: <Pine.LNX.4.61.0411031754500.470@toltec.zanshin.com>
Hi Bart :)
* Bart Schaefer <schaefer@brasslantern.com> dixit:
> > > 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.
I didn't explained correctly O:)) I want it expanded within the
completion widget, not in the command line. The problem is that the
compadd call doesn't work if the WORD has '~' as the first character.
I want this:
$ cd ~X<TAB><TAB>
X11/ usr/ bin/ include/
And after that, insert the completions. If I 'translate' PREFIX
so the named dir is expanded, completion works OK, but then I have
the named dir translated in the command line.
I want to translate it only in the widget so compadd can
correctly generate the list.
> > 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.
I'll take a look, but my problem is that I don't understand most
of the code. It is not very readable and is quite complex for me O:)
But I'll take a look at _tilde_files. Thanks for the reference.
> > 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.
Thanks a lot, Bart, I'll take a look at _tilde_files and try to
get the point. Thanks for coming to the rescue again ;)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
prev parent reply other threads:[~2004-11-04 10:32 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
2004-11-04 10:33 ` DervishD [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=20041104103358.GC23673@DervishD \
--to=zsh@dervishd.net \
--cc=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).