]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/themes/half-life.zsh-theme
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / themes / half-life.zsh-theme
1 # prompt style and colors based on Steve Losh's Prose theme:
2 # https://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
3 #
4 # vcs_info modifications from Bart Trojanowski's zsh prompt:
5 # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
6 #
7 # git untracked files modification from Brian Carper:
8 # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
9
10 #use extended color palette if available
11 if [[ $TERM = (*256color|*rxvt*) ]]; then
12   turquoise="%{${(%):-"%F{81}"}%}"
13   orange="%{${(%):-"%F{166}"}%}"
14   purple="%{${(%):-"%F{135}"}%}"
15   hotpink="%{${(%):-"%F{161}"}%}"
16   limegreen="%{${(%):-"%F{118}"}%}"
17 else
18   turquoise="%{${(%):-"%F{cyan}"}%}"
19   orange="%{${(%):-"%F{yellow}"}%}"
20   purple="%{${(%):-"%F{magenta}"}%}"
21   hotpink="%{${(%):-"%F{red}"}%}"
22   limegreen="%{${(%):-"%F{green}"}%}"
23 fi
24
25 autoload -Uz vcs_info
26 # enable VCS systems you use
27 zstyle ':vcs_info:*' enable git svn
28
29 # check-for-changes can be really slow.
30 # you should disable it, if you work with large repositories
31 zstyle ':vcs_info:*:prompt:*' check-for-changes true
32
33 # set formats
34 # %b - branchname
35 # %u - unstagedstr (see below)
36 # %c - stagedstr (see below)
37 # %a - action (e.g. rebase-i)
38 # %R - repository path
39 # %S - path in the repository
40 PR_RST="%{${reset_color}%}"
41 FMT_BRANCH=" on ${turquoise}%b%u%c${PR_RST}"
42 FMT_ACTION=" performing a ${limegreen}%a${PR_RST}"
43 FMT_UNSTAGED="${orange} ●"
44 FMT_STAGED="${limegreen} ●"
45
46 zstyle ':vcs_info:*:prompt:*' unstagedstr   "${FMT_UNSTAGED}"
47 zstyle ':vcs_info:*:prompt:*' stagedstr     "${FMT_STAGED}"
48 zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
49 zstyle ':vcs_info:*:prompt:*' formats       "${FMT_BRANCH}"
50 zstyle ':vcs_info:*:prompt:*' nvcsformats   ""
51
52
53 function steeef_chpwd {
54   PR_GIT_UPDATE=1
55 }
56
57 function steeef_preexec {
58   case "$2" in
59   *git*|*svn*) PR_GIT_UPDATE=1 ;;
60   esac
61 }
62
63 function steeef_precmd {
64   (( PR_GIT_UPDATE )) || return
65
66   # check for untracked files or updated submodules, since vcs_info doesn't
67   if [[ -n "$(git ls-files --other --exclude-standard 2>/dev/null)" ]]; then
68     PR_GIT_UPDATE=1
69     FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${hotpink} ●${PR_RST}"
70   else
71     FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${PR_RST}"
72   fi
73   zstyle ':vcs_info:*:prompt:*' formats       "${FMT_BRANCH}"
74
75   vcs_info 'prompt'
76   PR_GIT_UPDATE=
77 }
78
79 # vcs_info running hooks
80 PR_GIT_UPDATE=1
81
82 autoload -U add-zsh-hook
83 add-zsh-hook chpwd steeef_chpwd
84 add-zsh-hook precmd steeef_precmd
85 add-zsh-hook preexec steeef_preexec
86
87 # ruby prompt settings
88 ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} "
89 ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
90 ZSH_THEME_RVM_PROMPT_OPTIONS="v g"
91
92 setopt prompt_subst
93 PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "