Tweak colors & symbols in zsh prompt

This commit is contained in:
Henrik Lissner 2017-10-06 12:16:15 +02:00
parent 4f39666b16
commit 6eef58edbb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -15,8 +15,8 @@ prompt_git_dirty() {
local r=$(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) local r=$(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null)
local l=$(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) local l=$(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null)
(( ${r:-0} > 0 )) && echo -n " %F{green}${r}" (( ${r:-0} > 0 )) && echo -n " %F{green}${r}-"
(( ${l:-0} > 0 )) && echo -n " %F{yellow}${l}" (( ${l:-0} > 0 )) && echo -n " %F{yellow}${l}+"
echo -n '%f' echo -n '%f'
} }
@ -45,7 +45,7 @@ prompt_init() {
zle-keymap-select() { zle-keymap-select() {
case $KEYMAP in case $KEYMAP in
vicmd) PROMPT_SYMBOL="%F{magenta}## " ;; vicmd) PROMPT_SYMBOL="%F{magenta}## " ;;
main|viins) PROMPT_SYMBOL="%(?.%F{blue}.%F{red})λ " ;; main|viins) PROMPT_SYMBOL="%(?.%F{cyan}.%F{red})λ " ;;
esac esac
zle reset-prompt zle reset-prompt
zle -R zle -R
@ -62,8 +62,8 @@ prompt_init() {
# show username@host if logged in through SSH # show username@host if logged in through SSH
[[ $SSH_CONNECTION ]] && prompt_username='%F{magenta}%n%F{244}@%m ' [[ $SSH_CONNECTION ]] && prompt_username='%F{magenta}%n%F{244}@%m '
RPROMPT='%F{cyan}%~ %F{magenta}${vcs_info_msg_0_}$(prompt_git_dirty)%f' RPROMPT=' %F{magenta}${vcs_info_msg_0_}$(prompt_git_dirty)%f'
PROMPT='${prompt_username}${PROMPT_SYMBOL:-$ }' PROMPT='%F{blue}%~ ${prompt_username}${PROMPT_SYMBOL:-$ }'
} }
prompt_init "$@" prompt_init "$@"