From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11487 invoked from network); 6 Jan 2000 11:41:26 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Jan 2000 11:41:26 -0000 Received: (qmail 29465 invoked by alias); 6 Jan 2000 11:41:12 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2833 Received: (qmail 29458 invoked from network); 6 Jan 2000 11:41:11 -0000 Date: Thu, 6 Jan 2000 12:41:10 +0100 (MET) Message-Id: <200001061141.MAA17838@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-users@sunsite.auc.dk In-reply-to: Andre Pang's message of Thu, 6 Jan 2000 19:44:32 +1100 Subject: Re: Prompt expansion, multi-job for Andre Pang wrote: > Hiya guys, > > I've got two completely separate questions about zsh. > > 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? Not built-in. But you can always do any calculation you need in the precmd function, stuff the result in the psvar array and use %v (or any parameter if you use PROMPT_SUBST). Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de