From 9ad879e927109196e43056dc315bec0d0165013d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juh=C3=A1sz=20P=C3=A9ter?= Date: Sun, 20 Oct 2013 01:23:59 +0200 Subject: [PATCH] -Add: replace screen tty number with unicode circled numbers --- git-prompt.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-prompt.sh b/git-prompt.sh index 58dbfaa..0eb8d7d 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -396,6 +396,17 @@ set_shell_label() { elif [[ "$TMUX" ]]; then tty=$(tmux display-message -p "#I") fi + + # replace tty number with circled numbers + if [[ $utf8_prompt ]]; then + declare -a circled_digits=(⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳) + if [[ "$tty" -ge 0 && "$tty" -le 20 ]]; then + tty="${circled_digits[$tty]} " + fi + unset circled_digits + else + tty=" $tty" + fi fi # we don't need tty name under X11 @@ -480,7 +491,7 @@ set_shell_label() { if [[ -n $id || -n $host ]] ; then [[ -n $id && -n $host ]] && at='@' || at='' - color_who_where="${id//\\/\\\\}${host:+$at_color$at$host_color$host}${tty:+ $tty}" + color_who_where="${id//\\/\\\\}${host:+$at_color$at$host_color$host}${tty:+$tty}" plain_who_where="${id}$at$host" # if root then make it root_color