Added vi mode support for gnzh theme

This commit is contained in:
Joakim Reinert 2014-08-29 10:01:06 +02:00
commit 8312243fb1

View file

@ -31,7 +31,34 @@ else
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
fi fi
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" set-return-code() {
typeset -g return_code=""
if [[ $__prompt_status != 0 ]]; then
return_code="%{$PR_RED%}$__prompt_status ↵%{$PR_NO_COLOR%}"
fi
}
set-rps1() {
local mode=''
if [[ $KEYMAP = vicmd ]]; then
mode='%{$PR_RED%}[CMD]%{$PR_NO_COLOR%}'
fi
RPS1="${return_code} ${mode}"
zle reset-prompt
}
zle-line-init() {
typeset -g __prompt_status="$?"
set-return-code
set-rps1
}
zle-keymap-select() {
set-rps1
}
zle -N zle-keymap-select
zle -N zle-line-init
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}' local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}' local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'