b70a703a09627e6d96fe9184e9a40395b625a0cd

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

trapd00r: clean up the script

Diff

This diff is truncated to protect this page.

  1diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme
  2index 7c36487b3dc74b394e8851bb88c2bc8270e75024..144d2549a5012de806761d20998a18ac5200d17d 100755
  3--- a/themes/trapd00r.zsh-theme
  4+++ b/themes/trapd00r.zsh-theme
  5@@ -1,8 +1,8 @@
  6 # trapd00r.zsh-theme
  7 #
  8 # This theme needs a terminal supporting 256 colors as well as unicode.
  9-# In order to avoid external dependencies, it also embeds a (possibly old)
 10-# copy of the perl script located at https://github.com/trapd00r/utils/blob/master/zsh_path,
 11+# In order to avoid external dependencies, it also has a zsh version of
 12+# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
 13 # which splits up the current path and makes it fancy.
 14 #
 15 # By default it spans over two lines like so:
 16@@ -21,20 +21,20 @@
 17 autoload -U add-zsh-hook
 18 autoload -Uz vcs_info
 19 
 20-local c0=$( printf "\e[m")
 21-local c1=$( printf "\e[38;5;245m")
 22-local c2=$( printf "\e[38;5;250m")
 23-local c3=$( printf "\e[38;5;242m")
 24-local c4=$( printf "\e[38;5;197m")
 25-local c5=$( printf "\e[38;5;225m")
 26-local c6=$( printf "\e[38;5;240m")
 27-local c7=$( printf "\e[38;5;242m")
 28-local c8=$( printf "\e[38;5;244m")
 29-local c9=$( printf "\e[38;5;162m")
 30-local c10=$(printf "\e[1m")
 31-local c11=$(printf "\e[38;5;208m\e[1m")
 32-local c12=$(printf "\e[38;5;142m\e[1m")
 33-local c13=$(printf "\e[38;5;196m\e[1m")
 34+local c0=$'\e[m'
 35+local c1=$'\e[38;5;245m'
 36+local c2=$'\e[38;5;250m'
 37+local c3=$'\e[38;5;242m'
 38+local c4=$'\e[38;5;197m'
 39+local c5=$'\e[38;5;225m'
 40+local c6=$'\e[38;5;240m'
 41+local c7=$'\e[38;5;242m'
 42+local c8=$'\e[38;5;244m'
 43+local c9=$'\e[38;5;162m'
 44+local c10=$'\e[1m'
 45+local c11=$'\e[38;5;208m\e[1m'
 46+local c12=$'\e[38;5;142m\e[1m'
 47+local c13=$'\e[38;5;196m\e[1m'
 48 
 49 
 50 zsh_path() {
 51@@ -79,20 +79,19 @@ zsh_path() {
 52 
 53 
 54 # We don't want to use the extended colorset in the TTY / VC.
 55-if [ "$TERM" = "linux" ]; then
 56-    c1=$( printf "\e[34;1m")
 57-    c2=$( printf "\e[35m")
 58-    c3=$( printf "\e[31m")
 59-    c4=$( printf "\e[31;1m")
 60-    c5=$( printf "\e[32m")
 61-    c6=$( printf "\e[32;1m")
 62-    c7=$( printf "\e[33m")
 63-    c8=$( printf "\e[33;1m")
 64-    c9=$( printf "\e[34m")
 65-
 66-    c11=$(printf "\e[35;1m")
 67-    c12=$(printf "\e[36m")
 68-    c13=$(printf "\e[31;1m")
 69+if [ "$TERM" = linux ]; then
 70+  c1=$'\e[34;1m'
 71+  c2=$'\e[35m'
 72+  c3=$'\e[31m'
 73+  c4=$'\e[31;1m'
 74+  c5=$'\e[32m'
 75+  c6=$'\e[32;1m'
 76+  c7=$'\e[33m'
 77+  c8=$'\e[33;1m'
 78+  c9=$'\e[34m'
 79+  c11=$'\e[35;1m'
 80+  c12=$'\e[36m'
 81+  c13=$'\e[31;1m'
 82 fi
 83 
 84 zstyle ':vcs_info:*' actionformats \
 85@@ -112,14 +111,12 @@ prompt_jnrowe_precmd () {
 86     dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
 87     PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
 88 > '
 89-
 90-# modified, to be committed
 91+  # modified, to be committed
 92   elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
 93     dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
 94     PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
 95 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
 96 > '
 97-
 98   elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
 99     dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
100     PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
101@@ -130,8 +127,5 @@ prompt_jnrowe_precmd () {
102     PROMPT='${vcs_info_msg_0_}
103 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
104 > '