]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/themes/peepcode.zsh-theme
044534614f03cd948b31a1ba9deb4b02a606a92f
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / themes / peepcode.zsh-theme
1 #
2 # Based on Geoffrey Grosenbach's peepcode zsh theme from
3 # https://github.com/topfunky/zsh-simple
4 #
5
6 git_repo_path() {
7   command git rev-parse --git-dir 2>/dev/null
8 }
9
10 git_commit_id() {
11   command git rev-parse --short HEAD 2>/dev/null
12 }
13
14 git_mode() {
15   if [[ -e "$repo_path/BISECT_LOG" ]]; then
16     echo "+bisect"
17   elif [[ -e "$repo_path/MERGE_HEAD" ]]; then
18     echo "+merge"
19   elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then
20     echo "+rebase"
21   fi
22 }
23
24 git_dirty() {
25   if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then
26     echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
27   fi
28 }
29
30 git_prompt() {
31   local cb=$(git_current_branch)
32   if [[ -n "$cb" ]]; then
33     local repo_path=$(git_repo_path)
34     echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
35   fi
36 }
37
38 local smiley='%(?.%F{green}☺%f.%F{red}☹%f)'
39
40 PROMPT='
41 ${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~
42 ${smiley}  '
43
44 RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
45
46 # Disable automatic virtualenv prompt change
47 export VIRTUAL_ENV_DISABLE_PROMPT=1