1 autoload
-Uz promptinit
&& promptinit
3 function tool_versions
() {
4 if [[ -s ".tool-versions" ]]; then
8 echo "${HOME}/.tool-versions"
11 if [[ "$TERM" == (dumb
|linux
|*bsd
*) ]] || (( $#prompt_argv < 1 )); then
19 function prompt_precmd
{
27 function env_info_provider
() { echo "%{%F{green}%}n/a"; }
29 echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
32 function python_info
{
33 pythoninfo
=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2`
34 pythoninfo
=${ASDF_PYTHON_VERSION:-$pythoninfo}
35 venv
="${VIRTUAL_ENV##*/}"
36 echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
40 rubyinfo
=`cat "$(tool_versions)" | rg ruby | cut -d ' ' -f 2`
41 rubyinfo
=${ASDF_RUBY_VERSION:-$rubyinfo}
42 echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo:-no}"
46 nodeinfo
=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2`
47 nodeinfo
=${ASDF_NODEJS_VERSION:-$nodeinfo}
48 echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
52 [ -f ~
/.box
-name ] && cat ~
/.box
-name || hostname
-s
59 function zle
-line-init zle
-keymap-select {
61 # Couldn't figure out how to get tmux and iTerm to agree on how to render
62 # these characters... so there you go.
64 local normal_symbol
="N"
65 local insert_symbol
="I"
66 local error_symbol
="X"
68 # Show vi status / return status on the right side
70 local return_status
="%{%F{red}%}%(?.. $error_symbol)%{$reset_color%}"
71 if [ $KEYMAP = 'vicmd' ]; then
72 local edit_status
="%{%F{cyan}%}$normal_symbol"
74 local edit_status
="%{%F{green}%}$insert_symbol"
77 RPROMPT
="${edit_status}${return_status}%{$reset_color%}"
81 zle
-N zle
-keymap-select
87 function prompt_setup
{
89 unsetopt XTRACE KSH_ARRAYS
90 prompt_opts
=(cr percent subst
)
92 # Load required functions.
93 autoload
-Uz add
-zsh-hook
95 # Add hook for calling git-info before each command.
96 add
-zsh-hook precmd prompt_precmd
98 # Set git-info parameters.
99 zstyle
':git:info' verbose
'no'
100 zstyle
':git:info:branch' format
'@%F{cyan}%b%f'
101 zstyle
':git:info:clean' format
''
102 zstyle
':git:info:added' format
'%{%F{green}%}!'
103 zstyle
':git:info:modified' format
'%{%F{green}%}?'
104 zstyle
':git:info:untracked' format
'%{%F{magenta}%}?'
105 zstyle
':git:info:keys' format \
110 %{%F{black}%}$(env_info) $(node_info) $(ruby_info) $(python_info)
111 %{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%}
112 %(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
117 setopt PROMPT_PERCENT
118 setopt TRANSIENT_RPROMPT