File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 5
5
# mnml: https://github.com/subnixr/minimal
6
6
7
7
typeset -gA GEOMETRY
8
- GEOMETRY[ROOT]=${0: A: h}
9
8
10
9
(( $+ GEOMETRY_PROMPT)) || GEOMETRY_PROMPT=(geometry_echo geometry_status geometry_path)
11
10
(( $+ GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_exec_time geometry_git geometry_hg geometry_echo)
12
11
(( $+ GEOMETRY_INFO)) || GEOMETRY_INFO=(geometry_hostname geometry_jobs)
13
12
14
13
autoload -U add-zsh-hook
15
14
16
- function { local fun; for fun (" ${GEOMETRY[ROOT] } " /functions/geometry_* .zsh(N.)) . $fun }
15
+ function { local fun; for fun (" ${0 : A : h } " /functions/geometry_* .zsh(N.)) . $fun }
17
16
18
17
(( $+ functions[ansi] )) || ansi () { (( $# - 2 )) || echo -n " %F{$1 }$2 %f" ; }
19
18
20
- : ${GEOMETRY[TIME_COLOR_SHORT]:= green}
21
- : ${GEOMETRY[TIME_COLOR_NEUTRAL]:= default}
22
- : ${GEOMETRY[TIME_COLOR_LONG]:= red}
23
-
24
19
# Takes number of seconds and formats it for humans
25
20
# from https://github.com/sindresorhus/pretty-time-zsh
26
21
geometry::time () {
@@ -34,10 +29,10 @@ geometry::time() {
34
29
m=$(( seconds / 60 % 60 ))
35
30
s=$(( seconds % 60 ))
36
31
37
- (( d > 0 )) && human+=" ${d} d" && color= $GEOMETRY [TIME_COLOR_LONG]
38
- (( h > 0 )) && human+=" ${h} h" && : ${color:= $GEOMETRY [TIME_COLOR_NEUTRAL] }
32
+ (( d > 0 )) && human+=" ${d} d" && : ${ color:= ${GEOMETRY_TIME_COLOR_LONG :- red} }
33
+ (( h > 0 )) && human+=" ${h} h" && : ${color:= ${GEOMETRY_TIME_COLOR_NEUTRAL :- default} }
39
34
(( m > 0 )) && human+=" ${m} m"
40
- (( s > 0 )) && human+=" ${s} s" && : ${color:= $GEOMETRY [TIME_COLOR_SHORT] }
35
+ (( s > 0 )) && human+=" ${s} s" && : ${color:= ${GEOMETRY_TIME_COLOR_SHORT :- green} }
41
36
42
37
${2:- false} && ansi $color ${(j: : )human} || ansi $color $human [1]
43
38
}
You can’t perform that action at this time.
0 commit comments