parent
13b501adaf
commit
237cfc3c0b
@ -0,0 +1,59 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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: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='%F{blue}zsh: %F{yellow}correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
||||
}
|
||||
|
||||
prompt_giddie_setup "$@"
|
||||
|
||||
# vim: ft=zsh
|
Loading…
Reference in new issue