|
|
|
@ -1,48 +1,45 @@
|
|
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
# Features:
|
|
|
|
|
# - Simple VCS branch, staged, and unstaged indication.
|
|
|
|
|
# - Prompt character is different in a VCS repository.
|
|
|
|
|
# - Last command exit status is displayed when non-zero.
|
|
|
|
|
#
|
|
|
|
|
# Screenshots:
|
|
|
|
|
# http://i.imgur.com/rCo3S.png
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
function prompt_giddie_precmd {
|
|
|
|
|
vcs_info
|
|
|
|
|
|
|
|
|
|
# Replace "/home/<user>" with "~"
|
|
|
|
|
prompt_custom_wd=${PWD/#$HOME/\~}
|
|
|
|
|
_prompt_giddie_pwd="${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='±'
|
|
|
|
|
# Choose prompt symbol based on whether or not we are in a repository.
|
|
|
|
|
if (( $+commands[git] )) && git rev-parse 2> /dev/null; then
|
|
|
|
|
_prompt_giddie_symbol='±'
|
|
|
|
|
vcs_info
|
|
|
|
|
else
|
|
|
|
|
prompt_symbol=')'
|
|
|
|
|
_prompt_giddie_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 {
|
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
prompt_opts=(cr percent subst)
|
|
|
|
|
|
|
|
|
|
# Load required functions.
|
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
|
add-zsh-hook precmd prompt_giddie_precmd
|
|
|
|
|
|
|
|
|
|
prompt_opts=(cr percent subst)
|
|
|
|
|
# Add hook to call our function before each command
|
|
|
|
|
add-zsh-hook precmd prompt_giddie_precmd
|
|
|
|
|
|
|
|
|
|
zstyle ':omz:completion' indicator '%F{green}...%f'
|
|
|
|
|
zstyle ':omz:prompt' vicmd '%F{yellow}--- VI-COMMAND ---%f'
|
|
|
|
|
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
|
|
|
|
zstyle ':prezto:module:editor:info:keymap:alternate' format '%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'
|
|
|
|
@ -50,13 +47,13 @@ function prompt_giddie_setup {
|
|
|
|
|
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 '
|
|
|
|
|
# Define prompts.
|
|
|
|
|
PROMPT='%(?..%F{red}%B-> [%?]%b%f
|
|
|
|
|
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${_prompt_giddie_pwd}%f${vcs_info_msg_0_}
|
|
|
|
|
%F{blue}${_prompt_giddie_symbol}%f '
|
|
|
|
|
RPROMPT=
|
|
|
|
|
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prompt_giddie_setup "$@"
|
|
|
|
|
|
|
|
|
|
# vim: ft=zsh
|
|
|
|
|