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
4 # vcs_info modifications from Bart Trojanowski's zsh prompt:
5 # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
7 # git untracked files modification from Brian Carper:
8 # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
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}"}%}"
18 turquoise="%{${(%):-"%F{cyan}"}%}"
19 orange="%{${(%):-"%F{yellow}"}%}"
20 purple="%{${(%):-"%F{magenta}"}%}"
21 hotpink="%{${(%):-"%F{red}"}%}"
22 limegreen="%{${(%):-"%F{green}"}%}"
26 # enable VCS systems you use
27 zstyle ':vcs_info:*' enable git svn
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
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} ●"
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 ""
53 function steeef_chpwd {
57 function steeef_preexec {
59 *git*|*svn*) PR_GIT_UPDATE=1 ;;
63 function steeef_precmd {
64 (( PR_GIT_UPDATE )) || return
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
69 FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${hotpink} ●${PR_RST}"
71 FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${PR_RST}"
73 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
79 # vcs_info running hooks
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
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"
93 PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "