zsh のプロンプト

とりあえず以下に落ち着く.

# get the name of the branch we are on
git_prompt_info() {
    ref=$(git-symbolic-ref HEAD 2> /dev/null) || return
    echo "git:${ref#refs/heads/}|"
}
# get the name of the chroot we are on
chroot_info() {
    chroot=$(cat /etc/debian_chroot 2>/dev/null) || return
    echo "${chroot}|"
}
...
RPROMPT=$'[%{$fg_bold[green]%}$(chroot_info)%{$fg_bold[red]%}$(git_prompt_info)%{$fg_bold[white]%}%B%(5~,%-2~/.../%1~,%~)%b]'
case ${UID} in
    0)
        PROMPT=$'%U%{%B$fg[magenta]%}[%n@%m:%j:%(!.#.%%)%u%B>%b '
        ;;
    *)
        PROMPT=$'%U[%n@%m:%j:%(!.#.%%)%u%B>%b '
        ;;
esac
...

lsb_release とか /etc/issue とか, 教えて下さってありがとうございました. id:Say-no さん, のがじゅんさん, たかやさん. 結局こういう風に落ちつきました.

chroot 作った時は, /etc/debian_chroot 作っとく癖を付けなきゃなぁ...