1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/themes/giddie/prompt_giddie_setup

63 lines
1.8 KiB

#
# A colourful, friendly, multiline theme with some handy features:
#
# * Simple VCS branch, staged, and unstaged indication.
# * Prompt character is different in a VCS repository.
# * Last command exit status is displayed clearly if it was non-zero.
#
# This theme is particularly well-suited to the pastel colours used by KDE's
# Konsole terminal emulator.
#
# Screenshot: http://i.imgur.com/rCo3S.png
#
# Authors:
# Paul Gideon Dann <pdgiddie@gmail.com>
#
# TODO: Currently only tailored to git.
function prompt_giddie_precmd {
vcs_info
# Replace "/home/<user>" with "~"
prompt_custom_wd=${PWD/#$HOME/\~}
# Choose prompt symbol based on whether on not we're in a repository.
{ git branch 2>&1 } >/dev/null
if (( $? == 0 )); then
prompt_symbol='±'
else
prompt_symbol=')'
fi
# This will be displayed additionally if the last exit status was non-zero.
prompt_exit_status="%F{red}%B-> [%?]%b%f"
}
function prompt_giddie_setup {
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_giddie_precmd
prompt_opts=(cr percent subst)
zstyle ':omz:completion' indicator '%F{green}...%f'
zstyle ':omz:prompt' vicmd '%F{yellow}--- VI-COMMAND ---%f'
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u'
zstyle ':vcs_info:*' actionformats ' on %F{magenta}%b%f%c%u %F{yellow}(%a)%f'
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f'
PROMPT='%(?..${prompt_exit_status}
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${prompt_custom_wd}%f${vcs_info_msg_0_}
%F{blue}${prompt_symbol}%f '
RPROMPT=
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
}
prompt_giddie_setup "$@"
# vim: ft=zsh