-
Notifications
You must be signed in to change notification settings - Fork 91
/
.p10k-ascii-8color.zsh
168 lines (141 loc) · 6.38 KB
/
.p10k-ascii-8color.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs context)
if [[ -e ~/.ssh/id_rsa ]]; then
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS+=(my_git_dir vcs)
fi
if (( P9K_SSH )); then
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(time)
POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR=
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='-'
POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' '
POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' '
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_EXPANSION='%B%F{0}${P9K_GAP}%b%f'
fi
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS+=(newline prompt_char)
POWERLEVEL9K_MODE=ascii
POWERLEVEL9K_BACKGROUND=
POWERLEVEL9K_ICON_PADDING=none
POWERLEVEL9K_ICON_BEFORE_CONTENT=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE=
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' '
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR=
typeset -g POWERLEVEL9K_MULTILINE_{FIRST,NEWLINE,LAST}_PROMPT_{PREFIX,SUFFIX}=
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='<'
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V'
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='^'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=2
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1
POWERLEVEL9K_DIR_FOREGROUND=4
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
POWERLEVEL9K_SHORTEN_DELIMITER=
POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=4
POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=4
POWERLEVEL9K_DIR_ANCHOR_BOLD=false
POWERLEVEL9K_SHORTEN_FOLDER_MARKER=.git
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
POWERLEVEL9K_DIR_MAX_LENGTH=80
POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
POWERLEVEL9K_DIR_CLASSES=()
function prompt_my_git_dir() {
emulate -L zsh
[[ -n $GIT_DIR ]] || return
local repo=${GIT_DIR:t}
[[ $repo == .git ]] && repo=${GIT_DIR:h:t}
[[ $repo == .dotfiles-(public|private) ]] && repo=${repo#.dotfiles-}
p10k segment -b 0 -f 3 -t %B${repo//\%/%%}%b
}
function my_git_formatter() {
emulate -L zsh
if [[ -n $P9K_CONTENT ]]; then
typeset -g my_git_format=$P9K_CONTENT
return
fi
if (( $1 )); then
local meta='%f'
local clean='%2F'
local modified='%3F'
local untracked='%4F'
local conflicted='%1F'
else
local meta='%f'
local clean='%f'
local modified='%f'
local untracked='%f'
local conflicted='%f'
fi
local res where
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
fi
(( $#where > 32 )) && where[13,-13]=".."
res+="${clean}${where//\%/%%}"
[[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}"
fi
if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then
res+=" ${modified}wip"
fi
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}<${VCS_STATUS_COMMITS_BEHIND}"
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}>${VCS_STATUS_COMMITS_AHEAD}"
(( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}<-${VCS_STATUS_PUSH_COMMITS_BEHIND}"
(( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" "
(( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}->${VCS_STATUS_PUSH_COMMITS_AHEAD}"
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
(( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}?${VCS_STATUS_NUM_UNTRACKED}"
(( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}-"
typeset -g my_git_format=$res
}
functions -M my_git_formatter 2>/dev/null
POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}'
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=
POWERLEVEL9K_VCS_CLEAN_FOREGROUND=2
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=2
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=3
POWERLEVEL9K_STATUS_EXTENDED_STATES=true
POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
typeset -g POWERLEVEL9K_STATUS_{OK,ERROR}=false
typeset -g POWERLEVEL9K_STATUS_{OK_PIPE,ERROR_PIPE,ERROR_SIGNAL}=true
typeset -g POWERLEVEL9K_STATUS_{OK,OK_PIPE}_FOREGROUND=2
typeset -g POWERLEVEL9K_STATUS_{ERROR,ERROR_PIPE,ERROR_SIGNAL}_FOREGROUND=1
typeset -g POWERLEVEL9K_STATUS_{OK,OK_PIPE}_VISUAL_IDENTIFIER_EXPANSION=
typeset -g POWERLEVEL9K_STATUS_{ERROR,ERROR_PIPE,ERROR_SIGNAL}_VISUAL_IDENTIFIER_EXPANSION=
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION=
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=1
() {
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
POWERLEVEL9K_CONTEXT_FOREGROUND=7
POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%B%n@$1
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@$1
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=7
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE=$1
} ${${${Z4H_SSH##*:}//\%/%%}:-%m}
POWERLEVEL9K_TIME_FOREGROUND=6
POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION=
POWERLEVEL9K_TRANSIENT_PROMPT=always
POWERLEVEL9K_INSTANT_PROMPT=quiet
POWERLEVEL9K_DISABLE_HOT_RELOAD=true
POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
[[ ! -v functions[p10k] ]] || p10k reload