]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/themes/af-magic.zsh-theme
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / themes / af-magic.zsh-theme
1 # af-magic.zsh-theme
2 #
3 # Author: Andy Fleming
4 # URL: http://andyfleming.com/
5
6 # dashed separator size
7 function afmagic_dashes {
8   # check either virtualenv or condaenv variables
9   local python_env="${VIRTUAL_ENV:-$CONDA_DEFAULT_ENV}"
10
11   # if there is a python virtual environment and it is displayed in
12   # the prompt, account for it when returning the number of dashes
13   if [[ -n "$python_env" && "$PS1" = \(* ]]; then
14     echo $(( COLUMNS - ${#python_env} - 3 ))
15   else
16     echo $COLUMNS
17   fi
18 }
19
20 # primary prompt: dashed separator, directory and vcs info
21 PS1="${FG[237]}\${(l.\$(afmagic_dashes)..-.)}%{$reset_color%}
22 ${FG[032]}%~\$(git_prompt_info)\$(hg_prompt_info) ${FG[105]}%(!.#.»)%{$reset_color%} "
23 PS2="%{$fg[red]%}\ %{$reset_color%}"
24
25 # right prompt: return code, virtualenv and context (user@host)
26 RPS1="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
27 if (( $+functions[virtualenv_prompt_info] )); then
28   RPS1+='$(virtualenv_prompt_info)'
29 fi
30 RPS1+=" ${FG[237]}%n@%m%{$reset_color%}"
31
32 # git settings
33 ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[075]}(${FG[078]}"
34 ZSH_THEME_GIT_PROMPT_CLEAN=""
35 ZSH_THEME_GIT_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}"
36 ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}"
37
38 # hg settings
39 ZSH_THEME_HG_PROMPT_PREFIX=" ${FG[075]}(${FG[078]}"
40 ZSH_THEME_HG_PROMPT_CLEAN=""
41 ZSH_THEME_HG_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}"
42 ZSH_THEME_HG_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}"
43
44 # virtualenv settings
45 ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[075]}["
46 ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}"