-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr3-fresh.zsh-theme
More file actions
81 lines (68 loc) · 2 KB
/
r3-fresh.zsh-theme
File metadata and controls
81 lines (68 loc) · 2 KB
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
function directory() {
local color="%{$fg_no_bold[white]%}";
# local directory="${PWD/#$HOME/~}";
local directory="%1~";
local color_reset="%{$reset_color%}";
echo "📁 ${color}${directory}${color_reset}";
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[red]%}(%{$fg_no_bold[yellow]%}";
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}";
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_no_bold[red]%}) 🚩 ";
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_no_bold[red]%}) ✅ ";
function update_git_status() {
# GIT_STATUS=$(git_prompt_info); # This disables the git prompt
GIT_STATUS=$(_omz_git_prompt_info);
}
function git_status() {
echo "${GIT_STATUS}"
}
function update_command_status() {
local arrow="";
local color_reset="%{$reset_color%}";
local reset_font="%{$fg_no_bold[white]%}";
if $1; then
arrow="%{$fg_bold[yellow]%}❱%{$fg_bold[blue]%}❱%{$fg_bold[red]%}❱";
else
arrow="%{$fg_bold[red]%}❱❱❱";
fi
COMMAND_STATUS="${arrow}${reset_font}${color_reset}";
}
update_command_status true;
function command_status() {
echo "${COMMAND_STATUS}"
}
output_command_execute_after() {
if [ "$COMMAND_TIME_BEIGIN" = "-20200325" ] || [ "$COMMAND_TIME_BEIGIN" = "" ]; then
return 1;
fi
local cmd="${$(fc -l | tail -1)#* }";
local color_cmd="";
if $1; then
color_cmd="$fg_no_bold[green]";
else
color_cmd="$fg_bold[red]";
fi
local color_reset="$reset_color";
cmd="${color_cmd}${cmd}${color_reset}"
}
precmd() {
local last_cmd_return_code=$?;
local last_cmd_result=true;
if [ "$last_cmd_return_code" = "0" ]; then
last_cmd_result=true;
else
last_cmd_result=false;
fi
update_git_status;
update_command_status $last_cmd_result;
output_command_execute_after $last_cmd_result;
}
setopt PROMPT_SUBST;
TMOUT=1;
TRAPALRM() {
if [ "$WIDGET" = "" ] || [ "$WIDGET" = "accept-line" ];
then
zle reset-prompt;
fi
}
PROMPT='$(directory) $(git_status)$(command_status) ';