From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11860 invoked from network); 6 Jan 2000 12:44:45 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Jan 2000 12:44:45 -0000 Received: (qmail 7753 invoked by alias); 6 Jan 2000 12:44:30 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2835 Received: (qmail 7746 invoked from network); 6 Jan 2000 12:44:30 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: "Andre Pang" , Subject: RE: Prompt expansion, multi-job for Date: Thu, 6 Jan 2000 15:44:26 +0300 Message-ID: <000701bf5843$c3f6fca0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <20000106194432.A488@bozar.ihug.com.au> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 > > 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