Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Outputting colored zsh prompts from an external script



seanh <snhmnd@xxxxxxxxx> 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@xxxxxxxxx>  http://chneukirchen.org



Messages sorted by: Reverse Date, Date, Thread, Author