/
robbyrussell.zsh-theme
47 lines (40 loc) · 1.36 KB
/
robbyrussell.zsh-theme
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
# Git: branch/detached head, dirty status
# Git: branch/detached head, dirty status
prompt_git() {
(( $+commands[git] )) || return
local PL_BRANCH_CHAR
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
PL_BRANCH_CHAR=$'\ue0a0' #
}
local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
fi
setopt promptsubst
autoload -Uz vcs_info
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${mode}"
fi
}
prompt_end() {
echo -n " "
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='${ret_status} %{$fg[cyan]%}%d%{$reset_color%} $(prompt_git)$(prompt_end)
➜ '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}
➜ "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}
➜ "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗
➜ "
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})
➜ "