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 17737
- From: seanh <snhmnd@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Outputting colored zsh prompts from an external script
- Date: Mon, 25 Mar 2013 14:05:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=8z4A49oNdJA6gdCKQcRDueKihO0mGwzqWd0K8ePpKPo=; b=nEY/PA/vIJa8oIkSe4EmH3cXxKcaQUltlfxajc4KTj8rGAmMGbrQz1lKNyDT817PQZ 88Vk5cEltPWHrzckut0qpIO23qjkSmnBKU5PxrSomUSwPU9DMUVI1sA4CmAqPErAWYxZ ZzTR2fb8yZwoKq2UVQ8auVYYNYLcD/YJgyxhvDoBGE65KNxwPDgnChXwDaoF3jS3T2eW vezH4ZzIFxhL9YTunWZPKfxkfnBp9tpfi93g5IgcHmhSXISnhUSShOdetARr6bCerhJA PoTV3bx0GMkKJEIRGFmiXNcLPDHU0ZBiraj4Jco6ssOl5ZNSyd9KB/ki9rZWMZ9qrGVn kz1g==
- In-reply-to: <871ub431wq.fsf@gmail.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>
> I ported this to zsh for fun:
>
> fishpwd() {
> local maxlen=${1:-20} pwd
> local -a segs
>
> segs=("${(s:/:)${(D)PWD}}")
>
> for i in {1..$(($#segs-1))}; do
> pwd=${(j:/:)segs}
> (( $#pwd <= maxlen )) && break
>
> segs[$i]=${segs[$i][1]}
> done
>
> print $pwd
> }
Yeah. I know that everything I want to do with zshprompt.py can be
done in pure zsh and I'm sure it can even be done elegantly in zsh.
The prompt I'm using right now, until I get zshprompt.py colors
working, is a pure zsh prompt that I implemented that has most of
zshprompt.py's features.
But the problem is that your zsh code is completely meaningless to me
because I don't know zsh. If I learned zsh well enough to do the
prompt I want, the in six months' time when I want to change my
prompt or fix a bug I'll have forgotten all about it again because I
won't have used zsh scripting since. I write Python every day, so
being able to define zsh prompts by calling external programs (python
or otherwise) seems really empowering for letting more people hack
their zsh prompts.
So far this color issue is the only thing getting in my way...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author