From: Christian Neukirchen <chneukirchen@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Outputting colored zsh prompts from an external script
Date: Mon, 25 Mar 2013 16:42:25 +0100 [thread overview]
Message-ID: <87wqsv1o66.fsf@gmail.com> (raw)
In-Reply-To: <CAMvu5b+RCigGy-rjtyQB_H_vYF1MPC4PjEW0NBgFYrJEYnViZw__868.462134576653$1364217014$gmane$org@mail.gmail.com> (seanh's message of "Mon, 25 Mar 2013 14:05:42 +0100")
seanh <snhmnd@gmail.com> writes:
>> 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...
Then try generating "%F{...}" codes like in my other mail. It works here.
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org
next parent reply other threads:[~2013-03-25 15:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130324192345.GA20437@kaeru>
[not found] ` <871ub431wq.fsf@gmail.com>
[not found] ` <CAMvu5b+RCigGy-rjtyQB_H_vYF1MPC4PjEW0NBgFYrJEYnViZw__868.462134576653$1364217014$gmane$org@mail.gmail.com>
2013-03-25 15:42 ` Christian Neukirchen [this message]
[not found] <20130324192345.GA20437__22562.4022576541$1364153239$gmane$org@kaeru>
2013-03-24 21:30 ` Christian Neukirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wqsv1o66.fsf@gmail.com \
--to=chneukirchen@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).