-function prompt_ben_precmd {
+autoload -Uz promptinit && promptinit
+
+if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then
+ prompt 'off'
+fi
+
+#
+# Precmd
+#
+
+function prompt_precmd {
git-info
}
+#
+# Functions
+#
+
function virtualenv_info {
if [[ -z "$VIRTUAL_ENV" ]]; then
venv="default"
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
+#
+# ZLE widgets
+#
+
function zle-line-init zle-keymap-select {
- local return_status="%{%F{red}%}%(?..✘)%{$reset_color%}"
- RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}${return_status}%{$reset_color%}"
+ local return_status="%{%F{red}%}%(?..🆇)%{$reset_color%}"
+ if [ $KEYMAP = 'vicmd' ]; then
+ local edit_status="%{%F{cyan}%}🅽"
+ else
+ local edit_status="%{%F{green}%}🅸"
+ fi
+
+ RPS1="${edit_status} ${return_status}%{$reset_color%}"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
-function prompt_ben_setup {
+#
+# Setup Prompt
+#
+
+function prompt_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
- add-zsh-hook precmd prompt_ben_precmd
+ add-zsh-hook precmd prompt_precmd
# Set git-info parameters.
- zstyle ':prezto:module:git:info' verbose 'yes'
- zstyle ':prezto:module:git:info:branch' format '@%F{cyan}%b%f'
- zstyle ':prezto:module:git:info:clean' format ''
- zstyle ':prezto:module:git:info:added' format '%{%F{green}%}!'
- zstyle ':prezto:module:git:info:modified' format '%{%F{green}%}?'
- zstyle ':prezto:module:git:info:untracked' format '%{%F{magenta}%}?'
- zstyle ':prezto:module:git:info:keys' format \
+ zstyle ':git:info' verbose 'no'
+ zstyle ':git:info:branch' format '@%F{cyan}%b%f'
+ zstyle ':git:info:clean' format ''
+ zstyle ':git:info:added' format '%{%F{green}%}!'
+ zstyle ':git:info:modified' format '%{%F{green}%}?'
+ zstyle ':git:info:untracked' format '%{%F{magenta}%}?'
+ zstyle ':git:info:keys' format \
'prompt' '%b%a%m%u'
# Define prompts.
%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
}
-prompt_ben_setup "$@"
-
-#setopt PROMPT_SUBST
-
-ZSH_THEME_GIT_PROMPT_PREFIX="@%{%F{cyan}%}"
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DIRTY="%{%F{green}%}!"
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{%F{green}%}?"
-ZSH_THEME_GIT_PROMPT_CLEAN=""
-
+prompt_setup "$@"
+setopt PROMPT_SUBST