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
=`cat ~/.tool-versions | rg python | cut -d ' ' -f 2`
26 venv
="${VIRTUAL_ENV##*/}"
27 echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
31 rubyinfo
=`cat ~/.tool-versions | rg ruby | cut -d ' ' -f 2`
32 echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo:-no}"
36 nodeinfo
=`cat ~/.tool-versions | rg nodejs | cut -d ' ' -f 2`
37 echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
41 [ -f ~
/.box
-name ] && cat ~
/.box
-name || hostname
-s
48 function zle
-line-init zle
-keymap-select {
50 # Couldn't figure out how to get tmux and iTerm to agree on how to render
51 # these characters... so there you go.
53 local normal_symbol
="N"
54 local insert_symbol
="I"
55 local error_symbol
="X"
57 # Show vi status / return status on the right side
59 local return_status
="%{%F{red}%}%(?.. $error_symbol)%{$reset_color%}"
60 if [ $KEYMAP = 'vicmd' ]; then
61 local edit_status
="%{%F{cyan}%}$normal_symbol"
63 local edit_status
="%{%F{green}%}$insert_symbol"
66 RPROMPT
="${edit_status}${return_status}%{$reset_color%}"
70 zle
-N zle
-keymap-select
76 function prompt_setup
{
78 unsetopt XTRACE KSH_ARRAYS
79 prompt_opts
=(cr percent subst
)
81 # Load required functions.
82 autoload
-Uz add
-zsh-hook
84 # Add hook for calling git-info before each command.
85 add
-zsh-hook precmd prompt_precmd
87 # Set git-info parameters.
88 zstyle
':git:info' verbose
'no'
89 zstyle
':git:info:branch' format
'@%F{cyan}%b%f'
90 zstyle
':git:info:clean' format
''
91 zstyle
':git:info:added' format
'%{%F{green}%}!'
92 zstyle
':git:info:modified' format
'%{%F{green}%}?'
93 zstyle
':git:info:untracked' format
'%{%F{magenta}%}?'
94 zstyle
':git:info:keys' format \
99 %{%F{black}%}$(env_info) $(node_info) $(ruby_info) $(python_info)
100 %{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%}
101 %(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
106 setopt PROMPT_PERCENT
107 setopt TRANSIENT_RPROMPT