-
Notifications
You must be signed in to change notification settings - Fork 8
/
prompt_wordy_setup
79 lines (67 loc) · 2.41 KB
/
prompt_wordy_setup
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
#!/bin/env zsh
source $^fpath/prompt_framework(N)
prompt_wordy_setup() {
setopt localoptions noshwordsplit prompt_subst
# Load required modules
zmodload zsh/datetime
zmodload zsh/parameter
unset PS1 PS2 RPS1
prompt_clean_add_hooks
prompt_clean_zstyles
zstyle ':clean:normal:*' prompt-symbol '$'
zstyle ':vcs_info:*' unstagedstr '!'
zstyle ':vcs_info:*' stagedstr '+'
zstyle ':vcs_info:*:clean:*' untrackedstr '?'
if [[ -n $2 ]]; then
prompt_clean_pwd_length=$2
else
prompt_clean_pwd_length='3'
fi
local prompt_sym root_prompt_sym prompt_username term
zstyle -s ':clean:normal:render' prompt-symbol prompt_sym || prompt_sym='❯'
zstyle -s ':clean:root:render' prompt-symbol root_prompt_sym || root_prompt_sym='#'
if [[ -n $1 ]]; then
[[ $1 =~ '256color$' ]]; term=$?
else
[[ $TERM =~ '256color$' ]]; term=$?
fi
# show username@host if logged in through SSH
if [[ $SSH_CONNECTION != '' ]]; then
if [[ $term -eq 0 ]]; then
prompt_username='%F{83}%m%f:'
else
prompt_username='%F{10}%m%f:'
fi
fi
# ( which rvm-prompt &> /dev/null ) && rvm_prompt='%F{242}$(rvm-prompt)%f'
# Construct the new prompt with a clean preprompt.
local -ah ps1
if [[ $term -eq 0 ]]; then
ps1=(
$prompt_newline # Initial newline, for spaciousness.
$prompt_username
'%B%F{45}%5v%b%f' # Path
'%(1V. on %F{207}⎇ %1v%f%(2V. %B%F{203}[%2v]%b%f.)%(3V. %F{41}%3v.)%f.)' # VCS status
'%(4V. %F{215}%4v%f.)' # Execution time
$prompt_newline # Separate preprompt and prompt.
"%F{%(?.41.203)}%(!.$root_prompt_sym.$prompt_sym)%f " # Prompt symbol
)
PS2="%F{242}%_ %F{37}%(!.#.$prompt_sym)%f "
else
ps1=(
$prompt_newline # Initial newline, for spaciousness.
$prompt_username
'%F{14}%5v%f' # Path
'%(1V. on %F{13}%1v%(2V. %F{9}[%2v].)%(3V. %F{10}%3v.)%f.)' # VCS status
'%(4V. %F{11}%4v%f.)' # Execution time
$prompt_newline # Separate preprompt and prompt.
"%F{%(?.2.9)}%(!.$root_prompt_sym.$prompt_sym)%f " # Prompt symbol
)
PS2="%F{8}%_ %F{14}%(!.#.$prompt_sym)%f "
fi
PS1="${(j..)ps1}"
}
prompt_wordy_preview () {
prompt_preview_theme wordy "$@"
}
prompt_wordy_setup "$@"