Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: coloring the command-line?
- X-seq: zsh-users 12629
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: "Aaron Davies" <aaron.davies@xxxxxxxxx>
- Subject: Re: coloring the command-line?
- Date: Wed, 20 Feb 2008 01:02:10 +0100
- Cc: zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=v7t5CfyXRPr4pSnxB5ZSmNfcgCCJBu169aNysX639z0=; b=Gwl/fz59P3JD19Pj9sDXOnb0J/hyJxRvyhxCBbjJVEkxkeiQgUy3FgtkTMdjKxiNCC4iH9n9dq1cDWzYqeC0GSw72hNqdtmLM2xzzgCI4ukTqaYX0DnMWv7BLfu/2socbcsuBnrDdAjkbmjdkkwPiTE7tJ6sCOsjwt3jUxhR9iw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eLMNiZMOjGfmWiWlqEF3uU7543FVcBfqvydqIrDP4OpHry7Gv9/U2rKAjmw9xRx1u5pJa0l/eDwK5lmhriT//zSSxHZ8KOIUSTZaUDniIidHHoslsOxVW8kejxFyGxccz4kg9GPieKZfuiCc0zcajDOe7o6RZFknxnYWAcsyhSA=
- In-reply-to: <c4e763ac0802191523y1617fa66r8c6475a32990a526@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <c4e763ac0802191523y1617fa66r8c6475a32990a526@xxxxxxxxxxxxxx>
On 20/02/2008, Aaron Davies <aaron.davies@xxxxxxxxx> wrote:
> i'd like to have all the commands i type in (some) zsh shells appear
> in a color other than regular gray
>
> at the moment, i'm doing this in PS1
>
> export PS1='^[[0;31m%# '
>
> and it works decently, but has the drawback of screwing up alignment
> in some odd ways:
>
> if i use ^R to start a history search, the cursor jumps forward eight characters
>
> if i type off the end of the screen, it loops around to the beginning
>
> if i pull up a more-than-one-screen command with an up-arrow and start
> backing up to edit an early part of it, the cursor jumps to the line
> above
>
> etc.
>
> i assume there's a better state to leave the tty in that doesn't have
> these side effects?
Enclose the escape code with %{ and %} and it should work fine. Ie
something like
export PS1='%{\e[0;31m%}%# '
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author