mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Added vi mode support for gnzh theme
This commit is contained in:
parent
7410dc3876
commit
8312243fb1
1 changed files with 28 additions and 1 deletions
|
|
@ -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%}'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue