From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13235 invoked from network); 26 Feb 2002 19:21:51 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 26 Feb 2002 19:21:51 -0000 Received: (qmail 21569 invoked by alias); 26 Feb 2002 19:21:34 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4699 Received: (qmail 21555 invoked from network); 26 Feb 2002 19:21:32 -0000 Date: Tue, 26 Feb 2002 11:21:19 -0800 (PST) From: Bart Schaefer Sender: To: Ian Lynagh cc: Subject: Re: Length of %? in prompt In-Reply-To: <20020226184213.GA16659@stu163.keble.ox.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 26 Feb 2002, Ian Lynagh wrote: > One more thing...as the first % escapes the second in > "%%1v>-->%?---------%<< " it looks like there is no way to change this > value on the fly without recreating the prompt - is this correct? If you "setopt promptsubst" you can use a variable for the width: setopt promptsubst W=5 PS1='%$W>-->%?----------%<< ' You just have to make sure there are as many hyphens in the truncate region as the largest value you ever expect to assign to W. If for some other reason you want to avoid promptsubst, you will have to recreate the prompt, or at least recreate one of the psvar values like this: W=5 PS1='%1v ' precmd { psvar[1]=${(%%):-%$W>-->%?----------%<<} } Just be sure that the prompt expansion of %? is the first thing in precmd, or else it'll get the exit status of whatever other commands appear in precmd rather than the exit status of the last interactive command.