Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Named directories
- X-seq: zsh-users 8550
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Named directories
- Date: Sat, 26 Feb 2005 14:17:49 -0800 (PST)
- In-reply-to: <2e24629722633f291ea82664e14cbc5d@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2e24629722633f291ea82664e14cbc5d@xxxxxxxxxx>
- Reply-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
On Mon, 21 Feb 2005, Mika Seppänen wrote:
> If my homedir is /home/foo and I have named directory:
>
> work=/home/foo/bar
>
> Then if I switch to that dir (cd work), %~ expands to ~/bar. Is there any way
> to make it expand to ~work?
One thing that no one has mentioned in this thread is that %~ will always
expand to the shortest possible string.
Thus, given
two=$HOME/bin
three=$HOME/bin
four=$HOME/bin
you'll always see ~two because "two" is shorter than "/bin". Even if you
"unset two", you'll never see ~three because both "/bin" and "four" are
shorter than "three". Because ~/bin and ~four are of equal length, what
you see is (I believe) dependent on hash table ordering, and therefore
unpredictable (though it should always be consistent).
Hey, PWS and the UTF-8 gang: If "bin" were in fact a name consisting of
three wide characters, i.e., they display as three characters but occupy
6 or more bytes, would the prompt code treat ~three as a shorter string
for purposes of the %~ expansion?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author