abca62add1a6d0ac34e697beac8682076d5c1dd7
- Author
- Michele Iacobone <michele.iacobone@gmail.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme
2index 3fa5d57ab99b1c4bb39945c9e2cee2c956ebe8ba..fa8d21898624bb143286b106fcd68ce205fe75bf 100644
3--- a/themes/trapd00r.zsh-theme
4+++ b/themes/trapd00r.zsh-theme
5@@ -1,8 +1,9 @@
6 # trapd00r.zsh-theme
7 #
8-# This theme needs a terminal supporting 256 colors as well as unicode. It also
9-# needs the script that splits up the current path and makes it fancy as located
10-# here: https://github.com/trapd00r/utils/blob/master/zsh_path
11+# This theme needs a terminal supporting 256 colors as well as unicode.
12+# In order to avoid external dependencies, it also embeds a (possibly old)
13+# copy of the perl script located at https://github.com/trapd00r/utils/blob/master/zsh_path,
14+# which splits up the current path and makes it fancy.
15 #
16 # By default it spans over two lines like so:
17 #
18@@ -35,6 +36,54 @@ local c11=$(printf "\e[38;5;208m\e[1m")
19 local c12=$(printf "\e[38;5;142m\e[1m")
20 local c13=$(printf "\e[38;5;196m\e[1m")
21
22+local zsh_path_pl='
23+
24+use strict;
25+use Term::ExtendedColor "fg";
26+
27+chomp(my $pwd = `pwd`);
28+
29+my @chars = split//, $pwd;
30+
31+my $i = 1;
32+
33+for(@chars) {
34+ if($_ eq "/") {
35+ if(defined($ENV{DISPLAY})) {
36+ if($i == 1) {
37+ print fg("green28", fg("bold", " /"));
38+ $i++;
39+ next;
40+ }
41+ }
42+ else {
43+ if($i == 1) {
44+ print "\e[31;1m /\e[0m";
45+ $i++;
46+ next;
47+ }
48+ }
49+
50+ if(defined($ENV{DISPLAY})) {
51+ print fg("yellow$i", " » ");
52+ $i += 6
53+ }
54+ else {
55+ print "\e[33m > \e[0m";
56+ $i += 6;
57+ }
58+ }
59+ else {
60+ if(defined($ENV{DISPLAY})) {
61+ print fg("green28", $_);
62+ }
63+ else {
64+ print "\e[34m$_\e[0m";
65+ }
66+ }
67+}
68+
69+'
70
71 # We don't want to use the extended colorset in the TTY / VC.
72 if [ "$TERM" = "linux" ]; then
73@@ -67,28 +116,29 @@ add-zsh-hook precmd prompt_jnrowe_precmd
74 prompt_jnrowe_precmd () {
75 vcs_info
76 if [ "${vcs_info_msg_0_}" = "" ]; then
77- dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
78+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(echo $zsh_path_pl | perl)%} %{$c0%}(%{$c5%}%?%{$c0%})"
79 PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
80 > '
81
82 # modified, to be committed
83 elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
84- dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
85+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(echo $zsh_path_pl | perl)%} %{$c0%}(%{$c5%}%?%{$c0%})"
86 PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
87 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
88 > '
89
90 elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
91- dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
92+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(echo $zsh_path_pl | perl)%} %{$c0%}(%{$c5%}%?%{$c0%})"
93 PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
94 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
95 %{$c13%}>%{$c0%} '
96 else
97- dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
98+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(echo $zsh_path_pl | perl)%} %{$c0%}(%{$c5%}%?%{$c0%})"
99 PROMPT='${vcs_info_msg_0_}
100 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
101 > '
102 fi
103 }
104