-
Notifications
You must be signed in to change notification settings - Fork 1
/
.purepower
165 lines (140 loc) · 7.22 KB
/
.purepower
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
#!/usr/bin/env bash
# Original location: https://github.com/romkatv/dotfiles-public/blob/master/.purepower
# This is how it'll look:
# https://raw.githubusercontent.com/romkatv/dotfiles-public/master/dotfiles/purepower.png.
# LEFT PROMPT
# * Your current directory is bright blue when under $HOME and brownish everywhere else.
# * A lock icon is shown on the far left if you cannot write to the current directory.
# * The prompt symbol on the left is '❮' when vicmd keymap is active and '❯' otherwise. It's green
# if the last command has succeeded and red if it has failed.
# * Git prompt colors:
# * Grey: prompt is refreshing in the background (happens only in large repositories).
# * Green: clean (no stated or unstaged changes and no untracked files).
# * Yellow: dirty (some stated or unstaged changes).
# * Teal: some untracked files but otherwise clean (no staged or unstaged changes).
# * Git prompt icons:
# * '@12345678' (git prompt color): detached HEAD at commit 12345678.
# * 'my-feature' (git prompt color): on branch my-feature.
# * 'my-feature|master' (git prompt color): on branch my-feature tracking remote branch master.
# * '#my-release' (git prompt color): on tag my-release.
# * '+' (yellow): staged changes.
# * '!' (yellow): unstaged changes.
# * '?' (teal): untracked files.
# * '⇡42' (green): 42 commits ahead of remote.
# * '⇣42' (green): 42 commits behind remote.
# * '*42' (green): 42 stashes.
#
# RIGHT PROMPT
#
# * Current time on the far right.
# * Last command execution time (in seconds).
# * Error code with an optional signal name of the last command if it failed, in red.
# * A gear icon if you have background jobs.
# * An unlocked lock icon if you are root.
# * If you type `custom_rprompt() { echo 'message' }`, you'll get 'message' shown on the right.
# Useful to integrate with your scripts that change some sort of state/environment.
# Remember that colors looks differently in different terminals. Use this script to choose what
# works best for you.
#1 l
# for ((i = 0; i != 256; ++i)); do print -P "%F{${(l:3::0:)i}}${(l:3::0:)i} TEST%f"; done
() {
emulate -L zsh && setopt no_unset pipe_fail
if (( ARGC )); then
echo -E "Usage: source ~/.purepower" >&2
return 1
fi
local mode=${PURE_POWER_MODE:-fancy}
case $mode in
fancy)
local vi_insert=$'\u276F'
local vi_cmd=$'\u276E'
local lock=$'\uF023'
local incoming=$'\u21E3'
local outgoing=$'\u21E1'
local root=$'\uF09C'
local jobs=$'\uF013'
;;
*)
if [[ $mode != portable ]]; then
echo -En "purepower: invalid mode: ${(qq)mode}; " >&2
echo -E "valid options are 'fancy' and 'portable'; falling back to 'portable'" >&2
fi
local vi_insert='>'
local vi_cmd='<'
local lock='X'
local incoming='<'
local outgoing='>'
local root='#'
local jobs='%%'
;;
esac
typeset -ga POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
dir_writable dir vcs)
typeset -ga POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
status command_execution_time root_indicator background_jobs custom_rprompt time)
if (( ${PURE_POWER_USE_P10K_EXTENSIONS:-1} )); then
local p="\${\${\${KEYMAP:-0}:#vicmd}:+${${vi_insert//\\/\\\\}//\}/\\\}}}"
p+="\${\${\$((!\${#\${KEYMAP:-0}:#vicmd})):#0}:+${${vi_cmd//\\/\\\\}//\}/\\\}}}"
else
p=$vi_insert
fi
typeset -g POWERLEVEL9K_IGNORE_TERM_COLORS=true
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%(?.%F{002}${p}%f.%F{009}${p}%f) "
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=$'\n'
typeset -g POWERLEVEL9K_PROMPT_ON_NEWLINE=true
typeset -g POWERLEVEL9K_RPROMPT_ON_NEWLINE=false
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR=
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' '
typeset -g POWERLEVEL9K_WHITESPACE_BETWEEN_{LEFT,RIGHT}_SEGMENTS=
typeset -g POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND=none
typeset -g POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_VISUAL_IDENTIFIER_COLOR=003
typeset -g POWERLEVEL9K_LOCK_ICON=$lock
typeset -g POWERLEVEL9K_DIR_{ETC,HOME,HOME_SUBFOLDER,DEFAULT}_BACKGROUND=none
typeset -g POWERLEVEL9K_DIR_{ETC,DEFAULT}_FOREGROUND=209
typeset -g POWERLEVEL9K_DIR_{HOME,HOME_SUBFOLDER}_FOREGROUND=039
typeset -g POWERLEVEL9K_{ETC,FOLDER,HOME,HOME_SUB}_ICON=
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED,LOADING}_BACKGROUND=none
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=076
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=014
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=011
typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=244
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_UNTRACKEDFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_UNSTAGEDFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_MODIFIED_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_STAGEDFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_MODIFIED_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_INCOMING_CHANGESFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_CLEAN_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_OUTGOING_CHANGESFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_CLEAN_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_STASHFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_CLEAN_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_ACTIONFORMAT_FOREGROUND=001
typeset -g POWERLEVEL9K_VCS_LOADING_ACTIONFORMAT_FOREGROUND=$POWERLEVEL9K_VCS_LOADING_FOREGROUND
typeset -g POWERLEVEL9K_VCS_{GIT,GIT_GITHUB,GIT_BITBUCKET,GIT_GITLAB,BRANCH}_ICON=
typeset -g POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON=$'\b|'
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=$'\b?'
typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON=$'\b!'
typeset -g POWERLEVEL9K_VCS_STAGED_ICON=$'\b+'
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=$incoming
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=$outgoing
typeset -g POWERLEVEL9K_VCS_STASH_ICON='*'
typeset -g POWERLEVEL9K_VCS_TAG_ICON=$'\b#'
typeset -g POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND=none
typeset -g POWERLEVEL9K_ROOT_ICON=$root
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=none
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_COLOR=002
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_ICON=$jobs
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=none
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
typeset -g POWERLEVEL9K_EXECUTION_TIME_ICON=
typeset -g POWERLEVEL9K_TIME_BACKGROUND=none
typeset -g POWERLEVEL9K_TIME_FOREGROUND=244
typeset -g POWERLEVEL9K_TIME_ICON=
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=none
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=009
typeset -g POWERLEVEL9K_CARRIAGE_RETURN_ICON=
typeset -g POWERLEVEL9K_CUSTOM_RPROMPT=custom_rprompt
typeset -g POWERLEVEL9K_CUSTOM_RPROMPT_BACKGROUND=none
typeset -g POWERLEVEL9K_CUSTOM_RPROMPT_FOREGROUND=012
function custom_rprompt() {} # redefine this to show stuff in custom_rprompt segment
} "$@"