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