caa936593a6945cfcf21ca3f65acdd249586db13

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

Message

Merge pull request #7079 from mcornella/refactor-trapd00r-theme

Refactor trapd00r theme

Diff

This diff is truncated to protect this page.

  1diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme
  2old mode 100644
  3new mode 100755
  4index fa8d21898624bb143286b106fcd68ce205fe75bf..144d2549a5012de806761d20998a18ac5200d17d
  5--- a/themes/trapd00r.zsh-theme
  6+++ b/themes/trapd00r.zsh-theme
  7@@ -1,8 +1,8 @@
  8 # trapd00r.zsh-theme
  9 #
 10 # This theme needs a terminal supporting 256 colors as well as unicode.
 11-# In order to avoid external dependencies, it also embeds a (possibly old)
 12-# copy of the perl script located at https://github.com/trapd00r/utils/blob/master/zsh_path,
 13+# In order to avoid external dependencies, it also has a zsh version of
 14+# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
 15 # which splits up the current path and makes it fancy.
 16 #
 17 # By default it spans over two lines like so:
 18@@ -21,85 +21,77 @@
 19 autoload -U add-zsh-hook
 20 autoload -Uz vcs_info
 21 
 22-local c0=$( printf "\e[m")
 23-local c1=$( printf "\e[38;5;245m")
 24-local c2=$( printf "\e[38;5;250m")
 25-local c3=$( printf "\e[38;5;242m")
 26-local c4=$( printf "\e[38;5;197m")
 27-local c5=$( printf "\e[38;5;225m")
 28-local c6=$( printf "\e[38;5;240m")
 29-local c7=$( printf "\e[38;5;242m")
 30-local c8=$( printf "\e[38;5;244m")
 31-local c9=$( printf "\e[38;5;162m")
 32-local c10=$(printf "\e[1m")
 33-local c11=$(printf "\e[38;5;208m\e[1m")
 34-local c12=$(printf "\e[38;5;142m\e[1m")
 35-local c13=$(printf "\e[38;5;196m\e[1m")
 36-
 37-local zsh_path_pl=' 
 38-
 39-use strict;
 40-use Term::ExtendedColor "fg";
 41-
 42-chomp(my $pwd = `pwd`);
 43-
 44-my @chars = split//, $pwd;
 45-
 46-my $i = 1;
 47-
 48-for(@chars) {
 49-  if($_ eq "/") {
 50-    if(defined($ENV{DISPLAY})) {
 51-      if($i == 1) {
 52-        print fg("green28", fg("bold", " /"));
 53-        $i++;
 54-        next;
 55-      }
 56-    }
 57-    else {
 58-      if($i == 1) {
 59-        print "\e[31;1m /\e[0m";
 60-        $i++;
 61-        next;
 62-      }
 63-    }
 64-
 65-    if(defined($ENV{DISPLAY})) {
 66-      print fg("yellow$i", " » ");
 67-      $i += 6
 68-    }
 69-    else {
 70-      print "\e[33m > \e[0m";
 71-      $i += 6;
 72-    }
 73-  }
 74-  else {
 75-    if(defined($ENV{DISPLAY})) {
 76-      print fg("green28", $_);
 77-    }
 78-    else {
 79-      print "\e[34m$_\e[0m";
 80-    }
 81-  }
 82+local c0=$'\e[m'
 83+local c1=$'\e[38;5;245m'
 84+local c2=$'\e[38;5;250m'
 85+local c3=$'\e[38;5;242m'
 86+local c4=$'\e[38;5;197m'
 87+local c5=$'\e[38;5;225m'
 88+local c6=$'\e[38;5;240m'
 89+local c7=$'\e[38;5;242m'
 90+local c8=$'\e[38;5;244m'
 91+local c9=$'\e[38;5;162m'
 92+local c10=$'\e[1m'
 93+local c11=$'\e[38;5;208m\e[1m'
 94+local c12=$'\e[38;5;142m\e[1m'
 95+local c13=$'\e[38;5;196m\e[1m'
 96+
 97+
 98+zsh_path() {
 99+  local colors
100+  colors=$(echoti colors)
101+
102+  local -A yellow
103+  yellow=(
104+    1  '%F{228}'   2  '%F{222}'   3  '%F{192}'   4  '%F{186}'
105+    5  '%F{227}'   6  '%F{221}'   7  '%F{191}'   8  '%F{185}'
106+    9  '%F{226}'   10  '%F{220}'   11  '%F{190}'   12  '%F{184}'