1 autoload
-Uz promptinit
&& promptinit
3 if [[ "$TERM" == (dumb
|linux
|*bsd
*) ]] || (( $#prompt_argv < 1 )); then
11 function prompt_precmd
{
19 function env_info_provider
() { echo "%{%F{green}%}n/a"; }
21 echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
24 function python_info
{
25 pythoninfo
=`asdf current python | sed 's/ */ /g' | cut -d ' ' -f 2`
26 if [[ -z "$VIRTUAL_ENV" ]]; then
29 venv
="${VIRTUAL_ENV##*/}"
31 echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo}@${venv}"
35 rubyinfo
=`asdf current ruby | sed 's/ */ /g' | cut -d ' ' -f 2`
36 echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo}"
40 nodeinfo
=`asdf current nodejs | sed 's/ */ /g' | cut -d ' ' -f 2`
41 echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo}"
45 [ -f ~
/.box
-name ] && cat ~
/.box
-name || hostname
-s
52 function zle
-line-init zle
-keymap-select {
54 # Couldn't figure out how to get tmux and iTerm to agree on how to render
55 # these characters... so there you go.
57 local normal_symbol
="N"
58 local insert_symbol
="I"
59 local error_symbol
="X"
61 # Show vi status / return status on the right side
63 local return_status
="%{%F{red}%}%(?.. $error_symbol)%{$reset_color%}"
64 if [ $KEYMAP = 'vicmd' ]; then
65 local edit_status
="%{%F{cyan}%}$normal_symbol"
67 local edit_status
="%{%F{green}%}$insert_symbol"
70 RPROMPT
="${edit_status}${return_status}%{$reset_color%}"
74 zle
-N zle
-keymap-select
80 function prompt_setup
{
82 unsetopt XTRACE KSH_ARRAYS
83 prompt_opts
=(cr percent subst
)
85 # Load required functions.
86 autoload
-Uz add
-zsh-hook
88 # Add hook for calling git-info before each command.
89 add
-zsh-hook precmd prompt_precmd
91 # Set git-info parameters.
92 zstyle
':git:info' verbose
'no'
93 zstyle
':git:info:branch' format
'@%F{cyan}%b%f'
94 zstyle
':git:info:clean' format
''
95 zstyle
':git:info:added' format
'%{%F{green}%}!'
96 zstyle
':git:info:modified' format
'%{%F{green}%}?'
97 zstyle
':git:info:untracked' format
'%{%F{magenta}%}?'
98 zstyle
':git:info:keys' format \
103 %{%F{black}%}$(env_info) $(node_info) $(ruby_info) $(python_info)
104 %{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%}
105 %(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
110 setopt PROMPT_PERCENT
111 setopt TRANSIENT_RPROMPT