Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with named dirs in prompt expansion
- X-seq: zsh-workers 31586
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Manuel Presnitz <mpy@xxxxxxx>
- Subject: Re: Bug with named dirs in prompt expansion
- Date: Fri, 26 Jul 2013 18:31:17 -0400
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201210; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=DtQlttLhurGWO9Syrhj3HOnyMd19oKMNaCFif+VpuRU=; b=phq1ODhcuXDFStWFU6k5NUcZJbe8YaOaUeUtvnWtmShpFdn75a2U8wcrnFny/28iJMjn/rJlq3F2KhsnGk9Kap8mTK4QHjFOrjeiEVyGpobvj9hhWByWrpxS0DPfEto7/xkde3PWFp9kfqgLQuWmUM/45du0QjLkhvdPw7x+BFQ=;
- In-reply-to: <201307262058360115.008E9ADA@mail.gmx.net>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Manuel Presnitz <mpy@xxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <201307262058360115.008E9ADA@mail.gmx.net>
On 2013-07-26 at 20:58 +0200, Manuel Presnitz wrote:
> is it just me, or is there a bug in the "%~" prompt expansion:
It's the documented, specified behaviour. See zshexpn(1):
----------------------------8< cut here >8------------------------------
Static named directories
[...]
In certain circumstances (in prompts, for instance), when the shell
prints a path, the path is checked to see if it has a named directory
as its prefix. If so, then the prefix portion is replaced with a `~'
followed by the name of the directory. The shortest way of referring
to the directory is used, with ties broken in favour of using a named
directory, except when the directory is / itself. The parameters $PWD
and $OLDPWD are never abbreviated in this fashion.
----------------------------8< cut here >8------------------------------
> I would expect that after ": ~fooo" the prompt changes to "~fooo>", but it doesn't.
The idea of %~ is to find the shortest available name, for a condensed
representation so as to concisely convey to the user where they are.
> this issue was originally raised here: http://superuser.com/q/624603/195224
I've posted a reply.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author