blob: 1578a4709e81fcfa6d6d71eecdab6a95a1438253 (
plain)
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
|
# Matt Singleton's oh-my-zsh theme
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
svn info >/dev/null 2>/dev/null && echo 'ϟ' && return
echo '$'
}
function return_code {
code=$(echo $?)
if [[ $code == "0" ]]; then
return
else
echo "%{$fg[red]%}$code%{$reset_color%} "
fi
}
function parse_git_branch {
echo "${ref#refs/heads/}"
}
function parse_git_staged {
$(git diff-index --quiet --cached HEAD) && return
echo "staged"
}
function parse_git_unstaged {
$(git diff-files --quiet) && return
echo "unstaged"
}
function my_git_prompt_info {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
# # staged
# git diff-index --quiet --cached HEAD
# if [ $? -eq 1 ]; then
# echo "(%{$fg[yellow]%}${ref#refs/heads/}%{$reset_color%}) "
# return
# fi
# # uunstaged
# git ls-files --exclude-standard --others
# if [ $? -eq 1 ]; then
# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) "
# return
# fi
# # untracked and unignored
# git diff-files --quiet
# if [ $? -eq 1 ]; then
# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) "
# return
# fi
echo "(${ref#refs/heads/}) "
}
PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}
$(return_code)$(my_git_prompt_info)$(prompt_char) %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}"
ZSH_THEME_SVN_PROMPT_PREFIX="("
ZSH_THEME_SVN_PROMPT_SUFFIX=") "
ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}"
ZSH_THEME_SVN_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}"
|