#756138 zsh: please provide a prompt theme that reads /etc/debian_chroot

Package:
zsh
Source:
zsh
Description:
shell with lots of features
Submitter:
Felipe Sateler
Date:
2015-08-08 15:30:03 UTC
Severity:
wishlist
#756138#5
Date:
2014-07-26 17:30:53 UTC
From:
To:
Hi,

When logging into a porterbox, it would be quite useful to have a
theme that reads /etc/debian_chroot and puts it somewhere on the prompt.
The default debian bash prompt does that.

The default zsh config (as done when pressing 2 on initial zsh run)
loads the promptinit extension and enables a theme by default. However,
none of the themes reads out /etc/debian_chroot. I understand one could
provide this configuration by hand. However, since porterboxes are
things one uses relatively sparingly, a good-enough prompt by default
(or easily achievable) would be better than fetching configuration from
elsewhere, and then reloading zsh.

#756138#10
Date:
2015-08-08 14:30:31 UTC
From:
To:
A new prompt_debian_setup that no longer tries to mimic adam1 is
attached.

I think "#setopt no_beep" and "#stty -ixon" should also be added to
newuser.zshrc.recommended, but maybe we should concentrate on the
prompt for now.

#756138#15
Date:
2015-08-08 15:28:34 UTC
From:
To:
Hi Carsten,

I looked through the suggestions from your last mail; comments inline.

Carsten Hey wrote:
[...]

The latter might better be replaced by zsh's "no_flow_control" option.

[...]

You could also check something like a "blacklist" style, that could be a
list of term names (or better yet, patterns). That way you could
blacklist $TERMs like "emacs" for colours as well.

Good! I like it when people refrain from polluting the global parameter
name space just for prompt colours. This is good. :-)

[...]

Makes sense.

[...]


Maybe make these configurable via styles?

I think that looks reasonable.

To set defaults you can do:

  zstyle -s "$zstyle_pattern" dircolor dircolor || dircolor=4

And again, maybe rather use names instead of numbers:

  zstyle -s "$zstyle_pattern" dircolor dircolor || dircolor=blue

You also don't need to initialise to the empty string in the "local"
above.

Assembling a non-trivial prompt like always looks unreadable. I've seen
worse than this.

I don't understand this. "transientrprompt" can — and IMO should be —
set outside a prompt setup.

I'd do this in an "if ...; then...; fi" to improve readability.

[...]

Again, you can use the colour names instead of the numbers instead.

[...]

The contents of the ".thisfiledoesnotexist" file seems very similar to
the one of the "prompt_debian_setup" file. Attached by mistake?


Regards, Frank