Zsh Mailing List Archive
Messages sorted by:
Re: Tilde (%~) prompt expansion inconsistent with named directories?
- X-seq: zsh-users 13049
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: dackz <dackze@xxxxxxxxx>
- Subject: Re: Tilde (%~) prompt expansion inconsistent with named directories?
- Date: Mon, 21 Jul 2008 15:41:04 -0700
- Cc: zsh-users@xxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=RQMpvrRO3YAsH29SNevutxPz882B5t3HByQaXRzMQZhy8JM84eOUxCJ1NmLyDMxobWqLp+XVx8MCN0EmbaGXIZRSc6piJhWolNnbnxkl2QNgoWLV/llYl6b3A5STvePoTYl4sbdAZzjWjOQ42EznTkyFHN9bWz4iU3wEFQWiH98=;
- In-reply-to: <C40BEC83-7722-4379-894C-71B9D210C635@xxxxxxxxx>
- Mail-followup-to: dackz <dackze@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <C40BEC83-7722-4379-894C-71B9D210C635@xxxxxxxxx>
On 2008-07-21 at 18:18 -0400, dackz wrote:
> I'm guessing this has to do with the named directory cache not being
> populated. Shouldn't the expansion of %~ populate it automatically?
Debatable. Arguably the setting of a prompt shouldn't trigger
potentially large amounts of work (reading in the list of users from
LDAP, for instance, with >10k users).
There are arguments either way.
> Also, how is a directory determined to be named in prompt expansion?
The shortest match wins.
> If I run "cd ~www-data", "print -P '%~'" prints /var/www instead of
> ~www-data. I actually prefer this behavior, but I'm wondering how zsh
> makes the distinction in that case.
/var/www is the same length as www-data and shorter than ~www-data; zsh
will take the shortest match. If ~name is the same length or shorter
than /path then ~name will be used.
It's actually a complete scan through the entire list of all known
names, searching for the one with the "best" difference in length.
Messages sorted by: