Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Prompt expansion, multi-job for
- X-seq: zsh-users 2835
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Andre Pang" <andrep@xxxxxxxxxxx>, <zsh-users@xxxxxxxxxxxxxx>
- Subject: RE: Prompt expansion, multi-job for
- Date: Thu, 6 Jan 2000 15:44:26 +0300
- Importance: Normal
- In-reply-to: <20000106194432.A488@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
>
> 1) Let's say I'm in the /usr/local/src path at the moment. Normally, if
> you use the %~ prompt expansion, it will expand to /usr/local/src - no
> surprises there. What I'd like to do is trim each path element to one
> character unless it's the last path element, in which case it should be
> displayed to a maximum of, say, 15 characters. eg, /usr/local/src should be
> displayed as "/u/l/src", /usr/local/src/linux would be displayed as
> "/u/l/s/linux", and /usr/local/src/linux-2.2.14+reiserfs+raid+ide might be
> displayed as "/u/l/s/linux-2.2.14...". Is this possible with the current
> prompt expansion codes, or will I have to write up a function to do it, if
> it's possible to do at all?
>
In the current zsh
bor@itsrm2% echo ${PWD//(#m)[^\\/]##\\//$MATCH[1]/}
/t/s/zsh-3.1.6-dev-14
But you'll have to clamp the last component at 15 chars yourself anyway ... so
your are better off writing your own fuction for it.
/andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author