Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Outputting colored zsh prompts from an external script
- X-seq: zsh-users 17739
- From: seanh <snhmnd@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Outputting colored zsh prompts from an external script
- Date: Mon, 25 Mar 2013 20:40:00 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Jod+WDjcRmhFlEx6vPixGcXGLJdUGzgeX9OAew7MY4Y=; b=s2pAyfOIdwTPGG0NqJHhdaZXF+5zzl0137i+iVhLcowmcDkBQ/prG1+lnGHDA0z62o XEzrc0yFJLN96IyiNMXDUroD0vIxsDJKPoQXwReb9JMxHWrPQNU2E2rEa7KlbaXP/SY+ 2PRZGBdf23BXdEfEiLlJAr8VX4kxY1N26gOxq+SbIY94eHbJjRAH2ljhCD5kU0t1MEii iu3S76ilAUKPdj8bwnHmL50ApBhCEpyoD0GH8o4+H7fSaEDiFxvnaPX9cr3JhGk1Ucbl rcKWyVTEGYY8ce9VDEoryxMZyVNokyjEKbwTXHE1Ftdhg0oqfJT23Hl4k6vREGk9jgtz yReg==
- In-reply-to: <130325082938.ZM24580@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20130324192345.GA20437@kaeru> <871ub431wq.fsf@gmail.com> <CAMvu5b+RCigGy-rjtyQB_H_vYF1MPC4PjEW0NBgFYrJEYnViZw@mail.gmail.com> <130325082938.ZM24580@torch.brasslantern.com>
> > So far this color issue is the only thing getting in my way...
>
> Your python script needs to either output %F{color} / %K{color} instead
> of the raw ANSI sequences, or (might be easier) put %{ and %} around the
> ANSI. Both methods tell zsh that this output is "zero-width" on the
> terminal, so it doesn't count those bytes when determing how much screen
> space the prompt uses. See also %G in the manual.
That was exactly what I needed, thanks! Took all of two seconds to apply
and worked perfectly. I've updated the gist. The Python code could be
written more clearly, to make it explicit that the ANSI codes are
getting wrapped in zsh zero-width codes. Once I've given it some testing
and finished it off, I'll publish the script properly somewhere.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author